meteor-rest icon indicating copy to clipboard operation
meteor-rest copied to clipboard

Problem with `res.send` to download file?

Open thearabbit opened this issue 8 years ago • 2 comments
trafficstars

I use XlsxPopulate to generate and download XLSX file. In example to download with Express

router.get("/download", function (req, res, next) {
    // Open the workbook.
    XlsxPopulate.fromFileAsync("input.xlsx")
        .then(workbook => {
            // Make edits.
            workbook.sheet(0).cell("A1").value("foo");
            
            // Get the output
            return workbook.outputAsync();
        })
        .then(data => {
            // Set the output file name.
            res.attachment("output.xlsx");
            
            // Send the workbook.
            res.send(data);
        })
        .catch(next);
});

I tried in simple:json-routes, but don't work

thearabbit avatar Jun 16 '17 03:06 thearabbit

Did you get anywhere with this? I'll need to do something similar.

formspoint avatar Jul 03 '17 03:07 formspoint

still have problem

thearabbit avatar Jul 03 '17 06:07 thearabbit