Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Do not pause request for multipart parsing
Browse files Browse the repository at this point in the history
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
felixge authored and ry committed Dec 22, 2009
1 parent e6c5ac4 commit 5de04da
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/multipart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 5de04da

Please sign in to comment.