Skip to content

Commit

Permalink
Take in consideration other options like the Bucket for remove methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mdartic committed Mar 30, 2022
1 parent a1e52be commit 9af96af
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,17 @@ S3BlobStore.prototype.createWriteStream = function (opts, s3opts, done) {
* @param {function(Error)} done callback
*/
S3BlobStore.prototype.remove = function (opts, done) {
var key = typeof opts === 'string' ? opts : opts.key;
this.s3.deleteObject({ Bucket: this.bucket, Key: key }, done);
var params = {}
if (typeof opts === 'string') {
params.Key = opts;
} else {
opts = Object.assign({}, opts, {
params: Object.assign({}, opts.params)
});
params.Key = opts.key;
params.Bucket = opts.params.Bucket || this.bucket;
}
this.s3.deleteObject(params, done);
return this;
};

Expand Down

0 comments on commit 9af96af

Please sign in to comment.