summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/_fs/_fs_fdatasync.ts
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-01-24 10:31:52 +1100
committerGitHub <noreply@github.com>2024-01-24 00:31:52 +0100
commit2f47ec6c3a583c8323a06c386feeaee4fbf75edc (patch)
tree92511f544d3b8466fb84fa40f3e68163a4e97324 /ext/node/polyfills/_fs/_fs_fdatasync.ts
parent947ce41e99637dae4cf46126b8bb2d4107fb9913 (diff)
feat: `Deno.FsFile.dataSync()` and `Deno.FsFile.dataSyncSync()` (#22019)
This change: 1. Implements `Deno.FsFile.dataSync()` and `Deno.FsFile.dataSyncSync()`. 2. Deprecates `Deno.fdatasync()` and `Deno.fdatasyncSync()` for removal in Deno v2, in favour of the above corresponding methods. 3. Replaces use of `Deno.fdatasync()` and `Deno.fdatasyncSync()` with the above instance methods. Related #21995
Diffstat (limited to 'ext/node/polyfills/_fs/_fs_fdatasync.ts')
-rw-r--r--ext/node/polyfills/_fs/_fs_fdatasync.ts5
1 files changed, 3 insertions, 2 deletions
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();
}