summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/_fs
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-01-24 11:07:06 +1100
committerGitHub <noreply@github.com>2024-01-24 01:07:06 +0100
commit47620641e7455a0f9df82d17ad0405693e4427a4 (patch)
tree578a8c3fa25c157fb7cfa226d0f4b66b54995cda /ext/node/polyfills/_fs
parent2f47ec6c3a583c8323a06c386feeaee4fbf75edc (diff)
feat: `FsFile.sync()` and `FsFile.syncSync()` (#22017)
This change: 1. Implements `Deno.FsFile.sync()` and `Deno.FsFile.syncSync()`. 2. Deprecates `Deno.fsync()` and `Deno.fsyncSync()` for removal in Deno v2, in favour of the above corresponding methods. Related #21995 --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/node/polyfills/_fs')
-rw-r--r--ext/node/polyfills/_fs/_fs_fsync.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/node/polyfills/_fs/_fs_fsync.ts b/ext/node/polyfills/_fs/_fs_fsync.ts
index 489929227..942aecf6a 100644
--- a/ext/node/polyfills/_fs/_fs_fsync.ts
+++ b/ext/node/polyfills/_fs/_fs_fsync.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 fsync(
fd: number,
callback: CallbackWithError,
) {
- Deno.fsync(fd).then(() => callback(null), callback);
+ new FsFile(fd).sync().then(() => callback(null), callback);
}
export function fsyncSync(fd: number) {
- Deno.fsyncSync(fd);
+ new FsFile(fd).syncSync();
}