Permalink
Browse files

Do not pause request for multipart parsing

This is actually undesireable as it takes away control from the user who
may want to pause/resume to throttle the upload stream, or synchronize
it with disk flushing.

I actually ran into memory issues when trying to stream huge files to
disc as the file module was building up a huge action buffer. This can
now easily be avoided like this:

part.addListener('body', function(chunk) {
  req.pause();
  file.write(chunk).addCallback(function() {
    req.resume();
  });
}
  • Loading branch information...
1 parent e6c5ac4 commit 5de04dafc6c21cbfedc0f89859a21066e2741295 @felixge felixge committed with ry Dec 20, 2009
Showing with 0 additions and 4 deletions.
  1. +0 −4 lib/multipart.js
View
@@ -53,11 +53,7 @@ proto.init = function(options) {
var self = this;
req
.addListener('body', function(chunk) {
- req.pause();
self.write(chunk);
- setTimeout(function() {
- req.resume();
- });
})
.addListener('complete', function() {
self.emit('complete');

0 comments on commit 5de04da

Please sign in to comment.