diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-01-25 03:26:49 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 17:26:49 +0100 |
commit | f5097d9d3b62f7dc8e29e85e12f6a6f2858addbf (patch) | |
tree | 63a828e08571bf8bbde3e341e48392c91bf645fe /ext/node/polyfills/_fs | |
parent | 6b5c9764ac8087d035ef6a3f2542bd089957035e (diff) |
feat: `Deno.FsFile.{utime,utimeSync}()` and deprecate `Deno.{futime,futimeSync}` (#22070)
For removal in Deno v2.
---------
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/node/polyfills/_fs')
-rw-r--r-- | ext/node/polyfills/_fs/_fs_futimes.ts | 7 |
1 files changed, 5 insertions, 2 deletions
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); } |