0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-22 13:13:32 -05:00

Expose ctime to TS interface

This commit is contained in:
Lukasz Czerniawski 2024-07-29 16:06:48 +02:00
parent 86933ee41e
commit a939477f46
5 changed files with 14 additions and 0 deletions

View file

@ -303,6 +303,7 @@ impl<'a> VfsEntryRef<'a> {
atime: None, atime: None,
birthtime: None, birthtime: None,
mtime: None, mtime: None,
ctime: None,
blksize: 0, blksize: 0,
size: 0, size: 0,
dev: 0, dev: 0,
@ -325,6 +326,7 @@ impl<'a> VfsEntryRef<'a> {
atime: None, atime: None,
birthtime: None, birthtime: None,
mtime: None, mtime: None,
ctime: None,
blksize: 0, blksize: 0,
size: file.len, size: file.len,
dev: 0, dev: 0,
@ -347,6 +349,7 @@ impl<'a> VfsEntryRef<'a> {
atime: None, atime: None,
birthtime: None, birthtime: None,
mtime: None, mtime: None,
ctime: None,
blksize: 0, blksize: 0,
size: 0, size: 0,
dev: 0, dev: 0,

View file

@ -3583,6 +3583,10 @@ declare namespace Deno {
* field from `stat` on Mac/BSD and `ftCreationTime` on Windows. This may * field from `stat` on Mac/BSD and `ftCreationTime` on Windows. This may
* not be available on all platforms. */ * not be available on all platforms. */
birthtime: Date | null; birthtime: Date | null;
/** The last change time of the file. This corresponds to the `ctime`
* field from `stat` on Mac/BSD and `ChangeTime` on Windows. This may
* not be available on all platforms. */
ctime: Date | null;
/** ID of the device containing the file. */ /** ID of the device containing the file. */
dev: number; dev: number;
/** Inode number. /** Inode number.

View file

@ -381,6 +381,7 @@ function parseFileInfo(response) {
birthtime: response.birthtimeSet === true birthtime: response.birthtimeSet === true
? new Date(response.birthtime) ? new Date(response.birthtime)
: null, : null,
ctime: response.ctimeSet === true ? new Date(response.ctime) : null,
dev: response.dev, dev: response.dev,
ino: unix ? response.ino : null, ino: unix ? response.ino : null,
mode: unix ? response.mode : null, mode: unix ? response.mode : null,

View file

@ -229,6 +229,7 @@ impl FileSystem for InMemoryFs {
mtime: None, mtime: None,
atime: None, atime: None,
birthtime: None, birthtime: None,
ctime: None,
dev: 0, dev: 0,
ino: 0, ino: 0,
mode: 0, mode: 0,
@ -251,6 +252,7 @@ impl FileSystem for InMemoryFs {
mtime: None, mtime: None,
atime: None, atime: None,
birthtime: None, birthtime: None,
ctime: None,
dev: 0, dev: 0,
ino: 0, ino: 0,
mode: 0, mode: 0,

View file

@ -1750,6 +1750,8 @@ create_struct_writer! {
atime: u64, atime: u64,
birthtime_set: bool, birthtime_set: bool,
birthtime: u64, birthtime: u64,
ctime_set: bool,
ctime: u64,
// Following are only valid under Unix. // Following are only valid under Unix.
dev: u64, dev: u64,
ino: u64, ino: u64,
@ -1781,6 +1783,8 @@ impl From<FsStat> for SerializableStat {
atime: stat.atime.unwrap_or(0), atime: stat.atime.unwrap_or(0),
birthtime_set: stat.birthtime.is_some(), birthtime_set: stat.birthtime.is_some(),
birthtime: stat.birthtime.unwrap_or(0), birthtime: stat.birthtime.unwrap_or(0),
ctime_set: stat.ctime.is_some(),
ctime: stat.ctime.unwrap_or(0),
dev: stat.dev, dev: stat.dev,
ino: stat.ino, ino: stat.ino,