How to include huge json file (550MB) into node.js script?
var json = require('./huge-data-set.json')
node --max-old-space-size=4096 diff.js
throw new Error('"toString()" failed');
Error: "toString()" failed
at Buffer.toString (buffer.js:500:11)
at Object.fs.readFileSync (fs.js:552:33)
at Object.Module._extensions..json (module.js:556:20)
The error arises because you're trying to create a (single) string that is too large.
Some possible solutions: