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

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
@@ -1175,15 +1175,8 @@ async function mkdtemp(prefix, options) {
11751175
prefix=getValidatedPath(prefix,'prefix');
11761176
warnOnNonPortableTemplate(prefix);
11771177

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

0 commit comments

Comments
 (0)