Skip to content

Commit e0054ee

Browse files
YieldRayRafaelGSS
authored andcommitted
fs: ensure consistency for mkdtemp in both fs and fs/promises
Port changes for mkdtemp from lib/fs.js to lib/internal/fs/promise.js, ensuring consistent behavior. Refs: #51078 PR-URL: #53776 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
1 parent 2c44706 commit e0054ee

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

Diff for: lib/internal/fs/promises.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -1175,15 +1175,8 @@ async function mkdtemp(prefix, options) {
11751175
prefix = getValidatedPath(prefix, 'prefix');
11761176
warnOnNonPortableTemplate(prefix);
11771177

1178-
let path;
1179-
if (typeof prefix === 'string') {
1180-
path = `${prefix}XXXXXX`;
1181-
} else {
1182-
path = Buffer.concat([prefix, Buffer.from('XXXXXX')]);
1183-
}
1184-
11851178
return await PromisePrototypeThen(
1186-
binding.mkdtemp(path, options.encoding, kUsePromises),
1179+
binding.mkdtemp(prefix, options.encoding, kUsePromises),
11871180
undefined,
11881181
handleErrorFromBinding,
11891182
);

0 commit comments

Comments
 (0)