I'm trying to present a binary file for download via Node and Express.
The file is a Windows binary (.msi) and is around 26MB on disk.
Using Express, I can easily send the file as a download:
res.download('/path/to/file.msi', 'file.msi', function (error) {
if (error) {
log.error(error);
}
});
This seems to work correctly but the resulting downloaded .msi
file is almost 100% larger (49MB) and does not execute due to a bad file.
Is there anything else I should be doing to download the file correctly?
It turned out the problem only occurred when running the site locally. Hosting the application resulted in the expected download behavior.