feat(ext/fs): add ctime to Deno.stats and use it in node compat layer (#24801)

This PR fixes #24453, by introducing a ctime (using ctime for UNIX and
ChangeTime for Windows) to Deno.stats.

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
This commit is contained in:
Łukasz Czerniawski 2024-11-13 05:35:04 +01:00 committed by GitHub
parent 43812ee8ff
commit 7becd83a38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 88 additions and 15 deletions

View file

@ -290,8 +290,8 @@ export function convertFileInfoToStats(origin: Deno.FileInfo): Stats {
isFIFO: () => false,
isCharacterDevice: () => false,
isSocket: () => false,
ctime: origin.mtime,
ctimeMs: origin.mtime?.getTime() || null,
ctime: origin.ctime,
ctimeMs: origin.ctime?.getTime() || null,
});
return stats;
@ -336,9 +336,9 @@ export function convertFileInfoToBigIntStats(
isFIFO: () => false,
isCharacterDevice: () => false,
isSocket: () => false,
ctime: origin.mtime,
ctimeMs: origin.mtime ? BigInt(origin.mtime.getTime()) : null,
ctimeNs: origin.mtime ? BigInt(origin.mtime.getTime()) * 1000000n : null,
ctime: origin.ctime,
ctimeMs: origin.ctime ? BigInt(origin.ctime.getTime()) : null,
ctimeNs: origin.ctime ? BigInt(origin.ctime.getTime()) * 1000000n : null,
});
return stats;
}