From 00097918bfec9c282c3e6f56372bcd91f9674473 Mon Sep 17 00:00:00 2001 From: Vincent Giersch Date: Sun, 23 Mar 2014 19:52:44 +0100 Subject: [PATCH] Custom Buffer for streaming writes --- client/streaming.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/streaming.js b/client/streaming.js index 1df3ca6..d94a13e 100644 --- a/client/streaming.js +++ b/client/streaming.js @@ -78,7 +78,8 @@ StreamingUpload.prototype._endTransfer = function () { StreamingUpload.prototype.write = function (data, callback) { this.callback = callback; - var written = this.request.write(new Buffer(data.chunk, 'base64'), 'binary'); + var chunk = data.chunk instanceof Buffer ? data.chunk : new Buffer(data.chunk, 'base64'); + var written = this.request.write(chunk, 'binary'); if (written) { this._continueTransfer(data); } else {