Skip to content

Commit

Permalink
Merge pull request #19 from gierschv/feat-swift-buffer
Browse files Browse the repository at this point in the history
Custom Buffer for streaming writes
  • Loading branch information
gabrielhurley committed Apr 2, 2014
2 parents eae02fb + 0009791 commit cc2ac0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/streaming.js
Expand Up @@ -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 {
Expand Down

0 comments on commit cc2ac0d

Please sign in to comment.