Permalink
Browse files

Fix problem with pipe hanging from times to times, using data event c…

…ure the

problem
  • Loading branch information...
1 parent cadaf19 commit dd386916913043e5c1b34e20019eba029e203843 @xmilliard committed Dec 7, 2011
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/oauth.js
View
@@ -410,7 +410,15 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke
if( (method == "POST" || method =="PUT") && post_body != null && post_body != "" ) {
if(useFile) {
var rs = fs.createReadStream(post_body);
- rs.pipe(request);
+ // pipe hang on large file
+ // using data event cure the problem
+ //rs.pipe(request);
+ rs.on('data', function(chunk) {
+ request.write(chunk);
+ });
+ rs.on('end', function() {
+ request.end();
+ });
}else {
request.write(post_body);
request.end();

0 comments on commit dd38691

Please sign in to comment.