title: nodejs pipe or fs.rename FATAL ERROR: CALL_AND_RETRY_0 Allocation failed - process out of memory
body: <p>Interesting. Some large file got error. Some does not. </p>
  
  <p>Those file created by the following cmd does work.</p>
  
  <pre><code>dd if=/dev/zero of=/home/name/testfile.tar.gz bs=280M count=1
  </code></pre>
  
  <p>But some exe file does not work.</p>
  
  <p>test.js</p>
  
  <pre><code>var source  = fs.createReadStream(req.files.file.path);
  var dest    = fs.createWriteStream('/var/www/uploads/' + process.hrtime()[0] + process.hrtime()[1] + '_' + req.files.file.name);
  
  source.pipe(dest);
  
  source.on('end', function() { /* copied */ 
    console.log('end');
  });
  
  source.on('error', function(err) { /* error */ 
    console.log(err);
    console.log('error');
  });
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>fs.rename(req.files.file.path, '/var/www/name/uploads/' + process.hrtime()[0] + process.hrtime()[1] + '_' + req.files.file.name, function(err) {
    if(err)
      console.log(err);
    else
      console.log('file moved');
  });
  </code></pre>