fix(ext/node): fs.mkdtemp and fs.mkdtempSync compatibility (#30602)
Some checks are pending
ci / test release linux-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 / 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 debug macos-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions

`fs.mkdtemp` and `fs.mkdtempSync` now accept `Buffer` and `Uint8Array`
path. The implementation has been moved to Rust, including directory
suffix generation and directory creation.
This commit is contained in:
Daniel Osvaldo Rahmanto 2025-09-06 03:12:42 +07:00 committed by GitHub
parent 71a74cb1c6
commit e60f5d2c52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 264 additions and 97 deletions

View file

@ -814,17 +814,20 @@ export const getValidatedPath = hideStackFrames(
);
/**
* @param {string | Buffer | URL} fileURLOrPath
* @param {string | Buffer | Uint8Array | URL} fileURLOrPath
* @param {string} [propName]
* @returns string
*/
export const getValidatedPathToString = (fileURLOrPath, propName) => {
const path = getValidatedPath(fileURLOrPath, propName);
if (!Buffer.isBuffer(path)) {
return path;
if (isUint8Array(path)) {
return new TextDecoder().decode(path);
}
// deno-lint-ignore prefer-primordials
return path.toString();
if (Buffer.isBuffer(path)) {
// deno-lint-ignore prefer-primordials
return path.toString();
}
return path;
};
export const getValidatedFd = hideStackFrames((fd, propName = "fd") => {