keystonejs-contrib / k6-contrib

Keyston-6 contrib
MIT License
35 stars 18 forks source link

Files are not deleted from S3 bucket when the object is deleted from Keystone #24

Open vonba opened 2 years ago

vonba commented 2 years ago

When I delete an object from Keystone, uploaded files are not deleted. I can't see any configuration to enable this in the code, is this implemented at all?

If this isn't implemented, is there a workaround? It seems like a necessary feature to me, otherwise buckets will quickly fill up with trash, which also costs money.

gautamsi commented 2 years ago

you have to do this in the afterOperation hook.

vonba commented 2 years ago

@gautamsi thank you for reply. Does the library expose any function for setting up a connection to S3 and deleting the file?

Or would I need to implement something in parallel with the aws-sdk or similar?

gautamsi commented 2 years ago

Not really, you can hel set this up in a PR

vonba commented 2 years ago

Got it, I'll look into it because I will be needing this feature. What are you using under the hood to connect with S3, are you using an existing package for this?

gautamsi commented 2 years ago

it is based on aws-sdk

limegorilla commented 2 years ago

This is also the case for Azure blob storage - I'm assuming it's a similar story?

gautamsi commented 2 years ago

right, no support for deletion. but you can always delete them by calling aws-sdk directly