Skip to content

Commit c5be59a

Browse files
committed
improve warning message for large file reads in fs.readFile()
1 parent 2160d30 commit c5be59a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/internal/fs/promises.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,9 @@ async function readFileHandle(filehandle, options) {
526526

527527
if (size > kIoMaxLength) {
528528
process.emitWarning(
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.`,
529+
`Detected \`fs.readFile()\` to read a file larger than the recommended limit (${size} > ${limit} bytes). Please consider using \`fs.createReadStream()\` instead to minimize memory overhead and increase the performance.`,
530530
'LargeFileWarning',
531-
ERR_FS_FILE_TOO_LARGE,
531+
ERR_FS_FILE_TOO_LARGE
532532
);
533533
}
534534

0 commit comments

Comments
 (0)