1

I'm using the CollectionFS to store and download files from my application

<a href="{{this.url download=true}}">Download</a>

And I want to execute a server-side function when the file is downloaded (without using jQuery because it's not really credible and can be bypassed).

I was wondering if there's any undocumented function / workaround to execute my code/hook when there's a download, something like this:

filesCollection.on('download', function(fileObject){
  // do stuff
});

Thanks

Adlen Gharbi
  • 214
  • 2
  • 11
  • If `filesCollection` is a Mongo collection, you can use this package to add before/after hooks: https://atmospherejs.com/matb33/collection-hooks – Shanoor Mar 27 '16 at 03:22

1 Answers1

0

What you're looking for is called a transformRead in CollectionFS. It's the mirror function of transformWrite. Documentation.

Michel Floyd
  • 18,793
  • 4
  • 24
  • 39