Suggestion: Post-read hook
rune-bk opened this issue · 1 comments
Great package! Keep up the good work!
I just have a small suggestion. Support for temporary/N-time-access files.
It can in theory be accomplished in allow-read, but only if it's the second time it's being accessed.
I'd like to return the file, then wipe the file + collection document from the system. Specifically for generated files (excel reports etc etc)
Doing so in allow-deny upon first access would delete it before it's being returned.
Can it be accomplished in some way using the custom handler?
You can do this by defining a custom handler for GET requests on some route.
https://github.com/vsivsi/meteor-file-collection#configuring-http-methods
You could just reuse the default code, and then add whatever removal logic you want following a successful response.
https://github.com/vsivsi/meteor-file-collection/blob/master/src/http_access_server.coffee#L135
I'm not inclined to add this type of feature to the package directly because it adds complexity and API surface to test and maintain, but based on the above, I think the flexibility is there to implement the functionality you desire in your own code without too much trouble.