Skip to content

Commit 77f5e86

Browse files
committed
use error code
1 parent 2de146f commit 77f5e86

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/internal/fs/promises.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const {
3939
aggregateTwoErrors,
4040
codes: {
4141
ERR_ACCESS_DENIED,
42+
ERR_FS_FILE_TOO_LARGE,
4243
ERR_INVALID_ARG_VALUE,
4344
ERR_INVALID_STATE,
4445
ERR_METHOD_NOT_IMPLEMENTED,
@@ -525,7 +526,9 @@ async function readFileHandle(filehandle, options) {
525526

526527
if (size > kIoMaxLength) {
527528
process.emitWarning(
528-
`Warning: Detected \`fs.readFile()\` to read a huge file in memory (${size} bytes). Please consider using \`fs.createReadStream()\` instead to minimize memory overhead and increase the performance.`,
529+
`Detected \`fs.readFile()\` to read a huge file in memory (${size} bytes). Please consider using \`fs.createReadStream()\` instead to minimize memory overhead and increase the performance.`,
530+
'LargeFileWarning',
531+
ERR_FS_FILE_TOO_LARGE
529532
);
530533
}
531534

0 commit comments

Comments
 (0)