Skip to content

Commit 490f15a

Browse files
YieldRaymarco-ippolito
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 <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: LiviaMedeiros <[email protected]>
1 parent bf6aa53 commit 490f15a

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

lib/internal/fs/promises.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -1179,15 +1179,8 @@ async function mkdtemp(prefix, options) {
11791179
prefix = getValidatedPath(prefix, 'prefix');
11801180
warnOnNonPortableTemplate(prefix);
11811181

1182-
let path;
1183-
if (typeof prefix === 'string') {
1184-
path = `${prefix}XXXXXX`;
1185-
} else {
1186-
path = Buffer.concat([prefix, Buffer.from('XXXXXX')]);
1187-
}
1188-
11891182
return await PromisePrototypeThen(
1190-
binding.mkdtemp(path, options.encoding, kUsePromises),
1183+
binding.mkdtemp(prefix, options.encoding, kUsePromises),
11911184
undefined,
11921185
handleErrorFromBinding,
11931186
);

0 commit comments

Comments
 (0)