Closed zcrowe closed 7 years ago
I'm trying to delete a file from Amazon s3 just before a collection item containing a reference item to it is removed from a collection.
I'm using: https://github.com/Lepozepo/S3 to handle the s3 side.
What's the best way to handle the async aspect of dealing the file within the hook: Collection.before.remove(function (userId, doc) {}
Collection.before.remove(function (userId, doc) {}
Any pointers much appreciated :)
Just call your async code in the hook. If you want to be sure that the doc is removed, do it in an after hook
after
I'm trying to delete a file from Amazon s3 just before a collection item containing a reference item to it is removed from a collection.
I'm using: https://github.com/Lepozepo/S3 to handle the s3 side.
What's the best way to handle the async aspect of dealing the file within the hook:
Collection.before.remove(function (userId, doc) {}
Any pointers much appreciated :)