This hook allows plugins to observe file downloads.

If the plugin sets the redirectPath response property, the file download will not be audited.


Name Type Description
file File The file being downloaded
transform String A string specifying the requested transform, or the empty string if none requested.
permittingRef Ref The ref of the object which contained a file identified and was readable by the user, permitting this download. May be null.


Return information by changing these properties of the response object.

Name Type Description
redirectPath String If set, the user will be redirected to this path instead of downloading the file

JavaScript template

P.hook('hPreFileDownload', function(response, file, transform, permittingRef) {
    // Respond to hook, for example
    // response.redirectPath = ...