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 <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 bf6aa53 commit 490f15a

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

‎lib/internal/fs/promises.js‎

Lines changed: 1 addition & 8 deletions
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-
letpath;
1183-
if(typeofprefix==='string'){
1184-
path=`${prefix}XXXXXX`;
1185-
}else{
1186-
path=Buffer.concat([prefix,Buffer.from('XXXXXX')]);
1187-
}
1188-
11891182
returnawaitPromisePrototypeThen(
1190-
binding.mkdtemp(path,options.encoding,kUsePromises),
1183+
binding.mkdtemp(prefix,options.encoding,kUsePromises),
11911184
undefined,
11921185
handleErrorFromBinding,
11931186
);

0 commit comments

Comments
 (0)