fix(ext/node): fs.read and fs.write promisify compatibility (#30152)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions

Towards #29972
This commit is contained in:
Daniel Osvaldo R 2025-07-22 15:56:27 +07:00 committed by GitHub
parent fece050b60
commit a8ef9e151d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 0 deletions

View file

@ -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,

View file

@ -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,
});

View file

@ -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" = {}