diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/fs/30_fs.js | 8 | ||||
-rw-r--r-- | ext/node/polyfills/_fs/_fs_futimes.ts | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js index 810089950..2136d88f6 100644 --- a/ext/fs/30_fs.js +++ b/ext/fs/30_fs.js @@ -752,6 +752,14 @@ class FsFile { op_fs_fsync_sync(this.#rid); } + async utime(atime, mtime) { + await futime(this.#rid, atime, mtime); + } + + utimeSync(atime, mtime) { + futimeSync(this.#rid, atime, mtime); + } + [SymbolDispose]() { core.tryClose(this.#rid); } diff --git a/ext/node/polyfills/_fs/_fs_futimes.ts b/ext/node/polyfills/_fs/_fs_futimes.ts index 8a29db26b..9bd41e114 100644 --- a/ext/node/polyfills/_fs/_fs_futimes.ts +++ b/ext/node/polyfills/_fs/_fs_futimes.ts @@ -4,6 +4,7 @@ // deno-lint-ignore-file prefer-primordials import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts"; +import { FsFile } from "ext:deno_fs/30_fs.js"; function getValidTime( time: number | string | Date, @@ -38,7 +39,8 @@ export function futimes( atime = getValidTime(atime, "atime"); mtime = getValidTime(mtime, "mtime"); - Deno.futime(fd, atime, mtime).then(() => callback(null), callback); + // TODO(@littledivy): Treat `fd` as real file descriptor. + new FsFile(fd).utime(atime, mtime).then(() => callback(null), callback); } export function futimesSync( @@ -49,5 +51,6 @@ export function futimesSync( atime = getValidTime(atime, "atime"); mtime = getValidTime(mtime, "mtime"); - Deno.futimeSync(fd, atime, mtime); + // TODO(@littledivy): Treat `fd` as real file descriptor. + new FsFile(fd).utimeSync(atime, mtime); } |