title: What is the best way to include huge json into node.js script?
body: <p>How to include huge json file (550MB) into node.js script?</p>
  
  <p>I tried:</p>
  
  <pre><code>var json = require('./huge-data-set.json')
  </code></pre>
  
  <p>The script was executed with increased --max-old-space-size parameter</p>
  
  <pre><code>node --max-old-space-size=4096 diff.js
  </code></pre>
  
  <p>it failed with:</p>
  
  <pre><code>buffer.js:500
      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)
  </code></pre>