optimization: don't send mtime if not worthy

Massimo Melina committed Dec 20, 2021 at 21:21 UTC d0d89ce4fb0e87fc22a10dd0c6270a45a45ec8ed
1 file changed +4 -3
src/apis.ts
+4 -3
@@ -127,10 +127,11 @@ async function nodeToFile(node: VfsNode) {
127
128 function statToFile(name: string | undefined, stat:Stats) {
129 const folder = stat.isDirectory()
130 + const { ctime, mtime } = stat
131 return {
132 n: name + (folder ? '/' : ''),
132 - c: stat?.ctime,
133 - m: stat?.mtime,
134 - s: folder ? undefined : stat?.size,
133 + c: ctime,
134 + m: Math.abs(+mtime-+ctime) < 1000 ? undefined : mtime,
135 + s: folder ? undefined : stat.size,
136 }
137 }