s3-blob-store
Advanced tools
Comparing version 1.2.3 to 2.0.1
26
index.js
@@ -5,3 +5,3 @@ | ||
var mime = require('mime-types'); | ||
var through = require('through2'); | ||
var uploadStream = require('s3-stream-upload'); | ||
@@ -63,18 +63,12 @@ function S3BlobStore(opts) { | ||
var params = this.uploadParams(opts) | ||
var proxy = through(); | ||
proxy.pause(); | ||
params.Body = proxy; | ||
// var s3opts = {partSize: 10 * 1024 * 1024, queueSize: 1}; | ||
this.s3.upload(params, s3opts, function(err, data) { | ||
if (err) { | ||
debug('got err %j', err); | ||
proxy.emit('error', err) | ||
return done && done(err) | ||
} | ||
debug('uploaded %j', data); | ||
var out = uploadStream(this.s3, params) | ||
out.on('error', function (err) { | ||
debug('got err %j', err); | ||
return done && done(err) | ||
}) | ||
out.on('finish', function () { | ||
debug('uploaded'); | ||
done && done(null, { key: params.Key }) | ||
}); | ||
return proxy; | ||
}) | ||
return out; | ||
} | ||
@@ -81,0 +75,0 @@ |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "1.2.3", | ||
"version": "2.0.1", | ||
"repository": { | ||
@@ -24,3 +24,3 @@ "type": "git", | ||
"s3-download-stream": "0.0.5", | ||
"through2": "^0.6.1" | ||
"s3-stream-upload": "^2.0.1" | ||
}, | ||
@@ -27,0 +27,0 @@ "devDependencies": { |
@@ -33,4 +33,4 @@ | ||
var writer = store.createWriteStream({ key: 'test5.txt' }); | ||
writer.push("abc"); | ||
writer.push(null); | ||
writer.write("abc"); | ||
writer.end(); | ||
@@ -41,5 +41,5 @@ writer.on('error', function(ee){ | ||
writer.on('end', function(){ | ||
writer.on('finish', function(){ | ||
t.ok(true); | ||
}); | ||
}); |
7816
107
+ Addeds3-stream-upload@^2.0.1
+ Addedbuffer-queue@1.0.0(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addeds3-stream-upload@2.0.2(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedthrough2@^0.6.1
- Removedisarray@0.0.1(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedthrough2@0.6.5(transitive)
- Removedxtend@4.0.2(transitive)