title: NodeJS - Formidable 200 MB file limit and crash
body: <p>I have nodejs server:</p>
  
  <pre><code>var http = require('http');
  var formidable = require('formidable');
  var fs = require('fs');
  http.createServer(function (req, res) {
    if (req.url == '/fileupload') {
      console.log(req.rawHeaders)
      var form = new formidable.IncomingForm();
      form.parse(req, function (err, fields, files) {
        if (err) throw err;
        var oldpath = files.file.path
        var newpath = 'C:/VSI/' + files.file.name;
        fs.rename(oldpath, newpath, function (err) {
          //if (err) throw err;
          //res.write('File uploaded and moved!');
          if (err) {
            res.write(JSON.stringify({
              success: false,
              message: 'error happend'
            })
            );
            res.end()
            throw err;
          }
  
          res.write(JSON.stringify({
            success: true,
            message: 'Successfully Uploaded'
          })
          );
          res.end();
        });
      });
    } else {
      console.log(req.rawHeaders)
      res.writeHead(200, { 'Content-Type': 'text/html' });
      res.write('&lt;form action="fileupload" method="post" enctype="multipart/form-data"&gt;');
      res.write('&lt;input type="file" name="filetoupload"&gt;&lt;br&gt;');
      res.write('&lt;input type="submit"&gt;');
      res.write('&lt;/form&gt;');
      return res.end();
    }
  }).listen(8080, () =&gt; {
    console.log('server running')
  }).on("error", () =&gt; console.log("error happend"));
  </code></pre>
  
  <p>and get  </p>
  
  <pre><code>if (err) throw err;
                 ^
  
  Error: maxFileSize exceeded, received 209715683 bytes of file data
  </code></pre>
  
  <p>How I can upload more 200 MB with formidable?</p>
  
  <p>How properly handle exceptions and why "on error" on("error", () =>) event not work"?</p>
  
  <p>I tried Multer and it doesn't have 200 MB limit and work normally.</p>