summaryrefslogtreecommitdiff
path: root/cli/js/ops/fs
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2020-04-27 20:09:56 +0200
committerBert Belder <bertbelder@gmail.com>2020-04-27 21:13:32 +0200
commitee4e6a1ef9f51beaaef5e189302afe1db68ff6c1 (patch)
treed0a94be76718630b210c481e9b0f3171542b4007 /cli/js/ops/fs
parentc190a0dbc48e7de6a63a2f633f59054d40800600 (diff)
Rename FileInfo time fields and represent them as Date objects (#4932)
This patch also increases the resolution of reported file times to sub-millisecond precision.
Diffstat (limited to 'cli/js/ops/fs')
-rw-r--r--cli/js/ops/fs/stat.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/cli/js/ops/fs/stat.ts b/cli/js/ops/fs/stat.ts
index 6b7e5ea93..7f28614d2 100644
--- a/cli/js/ops/fs/stat.ts
+++ b/cli/js/ops/fs/stat.ts
@@ -4,9 +4,9 @@ import { build } from "../../build.ts";
export interface FileInfo {
size: number;
- modified: number | null;
- accessed: number | null;
- created: number | null;
+ mtime: Date | null;
+ atime: Date | null;
+ birthtime: Date | null;
dev: number | null;
ino: number | null;
mode: number | null;
@@ -26,9 +26,9 @@ export interface StatResponse {
isDirectory: boolean;
isSymlink: boolean;
size: number;
- modified: number;
- accessed: number;
- created: number;
+ mtime: number | null;
+ atime: number | null;
+ birthtime: number | null;
// Null for stat(), but exists for readdir().
name: string | null;
// Unix only members
@@ -51,9 +51,9 @@ export function parseFileInfo(response: StatResponse): FileInfo {
isDirectory: response.isDirectory,
isSymlink: response.isSymlink,
size: response.size,
- modified: response.modified ? response.modified : null,
- accessed: response.accessed ? response.accessed : null,
- created: response.created ? response.created : null,
+ mtime: response.mtime != null ? new Date(response.mtime) : null,
+ atime: response.atime != null ? new Date(response.atime) : null,
+ birthtime: response.birthtime != null ? new Date(response.birthtime) : null,
// Only non-null if on Unix
dev: isUnix ? response.dev : null,
ino: isUnix ? response.ino : null,