-
Notifications
You must be signed in to change notification settings - Fork 19
remove: use params helper like the other functions #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1cfbb96
to
e1b4ceb
Compare
Signed-off-by: William Casarin <jb55@jb55.com>
@@ -99,8 +102,8 @@ 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); | |||
const params = this.baseParams(opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to keep the typeof opts === 'string'
test ?
Or test it in the baseParams
function ?
As it is mentionned in https://github.com/maxogden/abstract-blob-store#storeremoveopts-cb,
the remove
methods accept either a string (and that's the key) or an object.
const filename = opts.name || opts.filename || params.Key; | ||
let contentType = opts.contentType || mime.lookup(filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think filename
is already present in params.Key
,
as in baseParams
function, you assign to params.Key
either opts.name
, opts.filename
or opts.key
.
const filename = opts.name || opts.filename || params.Key; | |
let contentType = opts.contentType || mime.lookup(filename) | |
const contentType = opts.contentType || mime.lookup(params.Key) |
Also, as contentType
is defined once, I think const
is better than let
?
@jb55 do you want to merge this PR ? or was it just to show how to implement the feature ? |
On Mon, Apr 25, 2022 at 12:49:27AM -0700, Mathieu DARTIGUES wrote:
***@***.*** do you want to merge this PR ? or was it just to show how to implement the feature ?
I was hoping those who wanted this feature could test it (via npm link
or something) and ACK before I merge. we don't really have a good test
suite yet. I haven't heard anything back.
|
alternative to #26
Signed-off-by: William Casarin jb55@jb55.com