0

I am using readFileSync() to read a file and get it as a buffer.

let buffer = fs.readFileSync(path);

But, actually, node can't open a file bigger than ~2 GB. Is there a way to enlarge the maximum allowed size of the buffer? Or an alternative that also could return me the file as a buffer?

Thx

  • You can refer to this post for answer to this question - https://stackoverflow.com/a/54857532/2235057. But it is always suggested to use streams for reading large files in node.js instead of increasing memory or buffer size. – Raeesaa Feb 05 '21 at 13:53
  • I understand, but, i'm not sure to undertstand how to modify it – Vladimir Tarasov Feb 05 '21 at 13:58

0 Answers0