I am using res.download() within a try - catch block. As per the official documentation res.download allows for a callback function for error/completion handling. I would like to promisify the res.download so that any error is directly handled in the catch block, to simplify the code. Using promisify(res.download) will throw an error:
"Cannot read property 'sendFile' of undefined"
Using promisify:
const download = promisify(response.download);
await download(someFilePath, 'someFileName');
Has any of you ever used the Express response.download async/promisified?