diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/fs/30_fs.js | 20 | ||||
-rw-r--r-- | ext/node/polyfills/_fs/_fs_fdatasync.ts | 5 |
2 files changed, 22 insertions, 3 deletions
diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js index 277a1c73c..3c888f1f1 100644 --- a/ext/fs/30_fs.js +++ b/ext/fs/30_fs.js @@ -1,6 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { core, primordials } from "ext:core/mod.js"; +import { core, internals, primordials } from "ext:core/mod.js"; const { isDate, } = core; @@ -558,10 +558,20 @@ async function symlink( } function fdatasyncSync(rid) { + internals.warnOnDeprecatedApi( + "Deno.fdatasyncSync()", + new Error().stack, + "Use `file.dataSyncSync()` instead.", + ); op_fs_fdatasync_sync(rid); } async function fdatasync(rid) { + internals.warnOnDeprecatedApi( + "Deno.fdatasync()", + new Error().stack, + "Use `await file.dataSync()` instead.", + ); await op_fs_fdatasync_async(rid); } @@ -703,6 +713,14 @@ class FsFile { return fstatSync(this.rid); } + async dataSync() { + await op_fs_fdatasync_async(this.rid); + } + + dataSyncSync() { + op_fs_fdatasync_sync(this.rid); + } + close() { core.close(this.rid); } diff --git a/ext/node/polyfills/_fs/_fs_fdatasync.ts b/ext/node/polyfills/_fs/_fs_fdatasync.ts index f6ed4a39b..482b4378c 100644 --- a/ext/node/polyfills/_fs/_fs_fdatasync.ts +++ b/ext/node/polyfills/_fs/_fs_fdatasync.ts @@ -4,14 +4,15 @@ // deno-lint-ignore-file prefer-primordials import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts"; +import { FsFile } from "ext:deno_fs/30_fs.js"; export function fdatasync( fd: number, callback: CallbackWithError, ) { - Deno.fdatasync(fd).then(() => callback(null), callback); + new FsFile(fd).dataSync().then(() => callback(null), callback); } export function fdatasyncSync(fd: number) { - Deno.fdatasyncSync(fd); + new FsFile(fd).dataSyncSync(); } |