Skip to content

Commit 9af96af

Browse files
committed
Take in consideration other options like the Bucket for remove methods
1 parent a1e52be commit 9af96af

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

index.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,17 @@ S3BlobStore.prototype.createWriteStream = function (opts, s3opts, done) {
9999
* @param {function(Error)} done callback
100100
*/
101101
S3BlobStore.prototype.remove = function (opts, done) {
102-
var key = typeof opts === 'string' ? opts : opts.key;
103-
this.s3.deleteObject({ Bucket: this.bucket, Key: key }, done);
102+
var params = {}
103+
if (typeof opts === 'string') {
104+
params.Key = opts;
105+
} else {
106+
opts = Object.assign({}, opts, {
107+
params: Object.assign({}, opts.params)
108+
});
109+
params.Key = opts.key;
110+
params.Bucket = opts.params.Bucket || this.bucket;
111+
}
112+
this.s3.deleteObject(params, done);
104113
return this;
105114
};
106115

0 commit comments

Comments
 (0)