Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Problem with res.send to download file? #137

Open
thearabbit opened this issue Jun 16, 2017 · 2 comments
Open

Problem with res.send to download file? #137

thearabbit opened this issue Jun 16, 2017 · 2 comments

Comments

@thearabbit
Copy link

thearabbit commented Jun 16, 2017

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

@formspoint
Copy link

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

@thearabbit
Copy link
Author

still have problem

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants