Skip to content

Commit 925c923

Browse files
committed
keep old variable
1 parent 14c4288 commit 925c923

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
@@ -48,6 +48,7 @@ const { isArrayBufferView } = require('internal/util/types');
4848
const console = require('internal/console/global');
4949
const {
5050
constants: {
51+
kIoMaxLength,
5152
kMaxUserId,
5253
kReadFileBufferLength,
5354
kReadFileUnknownBufferLength,
@@ -519,12 +520,11 @@ async function readFileHandle(filehandle, options) {
519520

520521
let size = 0;
521522
let length = 0;
522-
const maxFileSize = 2 ** 31 - 1; // 2 GiB limit for file size
523523

524524
if ((statFields[1 /* mode */] & S_IFMT) === S_IFREG) {
525525
size = statFields[8 /* size */];
526526

527-
if (size > maxFileSize) {
527+
if (size > kIoMaxLength) {
528528
process.emitWarning(
529529
`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.`,
530530
);

0 commit comments

Comments
 (0)