diff --git a/ext/node/polyfills/_fs/_fs_read.ts b/ext/node/polyfills/_fs/_fs_read.ts index c7f3acf4d8..082f4dca56 100644 --- a/ext/node/polyfills/_fs/_fs_read.ts +++ b/ext/node/polyfills/_fs/_fs_read.ts @@ -18,6 +18,10 @@ import { } from "ext:deno_node/internal/validators.mjs"; import { isArrayBufferView } from "ext:deno_node/internal/util/types.ts"; import { op_fs_seek_async, op_fs_seek_sync } from "ext:core/ops"; +import { primordials } from "ext:core/mod.js"; +import { customPromisifyArgs } from "ext:deno_node/internal/util.mjs"; + +const { ObjectDefineProperty } = primordials; type readSyncOptions = { offset: number; @@ -145,6 +149,12 @@ export function read( })(); } +ObjectDefineProperty(read, customPromisifyArgs, { + __proto__: null, + value: ["bytesRead", "buffer"], + enumerable: false, +}); + export function readSync( fd: number, buffer: ArrayBufferView, diff --git a/ext/node/polyfills/_fs/_fs_write.mjs b/ext/node/polyfills/_fs/_fs_write.mjs index a0d0af6017..25f3005729 100644 --- a/ext/node/polyfills/_fs/_fs_write.mjs +++ b/ext/node/polyfills/_fs/_fs_write.mjs @@ -19,6 +19,10 @@ import { import { isArrayBufferView } from "ext:deno_node/internal/util/types.ts"; import { maybeCallback } from "ext:deno_node/_fs/_fs_common.ts"; import { op_fs_seek_async, op_fs_seek_sync } from "ext:core/ops"; +import { primordials } from "ext:core/mod.js"; +import { customPromisifyArgs } from "ext:deno_node/internal/util.mjs"; + +const { ObjectDefineProperty } = primordials; export function writeSync(fd, buffer, offset, length, position) { fd = getValidatedFd(fd); @@ -132,3 +136,9 @@ export function write(fd, buffer, offset, length, position, callback) { (err) => callback(err), ); } + +ObjectDefineProperty(write, customPromisifyArgs, { + __proto__: null, + value: ["bytesWritten", "buffer"], + enumerable: false, +}); diff --git a/tests/node_compat/config.toml b/tests/node_compat/config.toml index dd0405ca1f..312faa5ad8 100644 --- a/tests/node_compat/config.toml +++ b/tests/node_compat/config.toml @@ -431,6 +431,7 @@ "parallel/test-fs-long-path.js" = {} "parallel/test-fs-promises-exists.js" = {} "parallel/test-fs-promises-readfile-empty.js" = {} +"parallel/test-fs-promisified.js" = {} "parallel/test-fs-read-file-sync-hostname.js" = {} "parallel/test-fs-read-stream-autoClose.js" = {} "parallel/test-fs-read-stream-double-close.js" = {}