title: Node.js: how to limit the HTTP request size and upload file size?
body: <p>I'm using Node.js and express. </p>
  
  <p>I would like to limit the HTTP request size. Let's say, if someone sends me a HTTP request more than 2 MB then I stop the request right away. I looked at the code and I think if I change the core, I can do it. However, is there a way to set a <code>max_request_size</code> or soemthing like that?</p>
  
  <p>It is kind of related to my second question. I'm using express to get an uploaded file from <code>req.files</code>. Is there a way to stop writing the file to the <code>/tmp</code> folder (which is the default upload behavior) as soon as the file size exceeds a certain file size?</p>