Skip to content

Commit 42fd640

Browse files
authored
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 fa0fde7 commit 42fd640

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

lib/internal/fs/promises.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,15 +1176,8 @@ async function mkdtemp(prefix, options) {
11761176
prefix = getValidatedPath(prefix, 'prefix');
11771177
warnOnNonPortableTemplate(prefix);
11781178

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

0 commit comments

Comments
 (0)