Skip to content

Commit 3acb547

Browse files
authored
fs: use missing validator for fsPromises
Refs: nodejs#39028
1 parent c8634ed commit 3acb547

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/internal/fs/promises.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const { Buffer } = require('buffer');
2929
const {
3030
codes: {
3131
ERR_FS_FILE_TOO_LARGE,
32-
ERR_INVALID_ARG_TYPE,
3332
ERR_INVALID_ARG_VALUE,
3433
ERR_METHOD_NOT_IMPLEMENTED,
3534
},
@@ -74,6 +73,7 @@ const {
7473
validateBuffer,
7574
validateEncoding,
7675
validateInteger,
76+
validateString,
7777
} = require('internal/validators');
7878
const pathModule = require('path');
7979
const { promisify } = require('internal/util');
@@ -708,9 +708,8 @@ async function realpath(path, options) {
708708

709709
async function mkdtemp(prefix, options) {
710710
options = getOptions(options, {});
711-
if (!prefix || typeof prefix !== 'string') {
712-
throw new ERR_INVALID_ARG_TYPE('prefix', 'string', prefix);
713-
}
711+
712+
validateString(prefix, 'prefix');
714713
nullCheck(prefix);
715714
warnOnNonPortableTemplate(prefix);
716715
return binding.mkdtemp(`${prefix}XXXXXX`, options.encoding, kUsePromises);

0 commit comments

Comments
 (0)