Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to download binary? #6

Open
marcus2vinicius opened this issue Nov 8, 2016 · 3 comments
Open

How to download binary? #6

marcus2vinicius opened this issue Nov 8, 2016 · 3 comments

Comments

@marcus2vinicius
Copy link

marcus2vinicius commented Nov 8, 2016

var data = template.generate();

using FileSaver.js

saveAs(data,"Rel.xlsx");

does not work

@ksafranski
Copy link

Try fs.writeFile (or writeFileSync) with encoding set to binary (see this test for full example)

fs.writeFileSync('test.xlsx', newData, 'binary')

@ksafranski
Copy link

As a note to the contributors, that little bit would make a nice addition to the docs/readme. It's a great lib and saved me a ton of time but I didn't think of the encoding on writeFile and kind of banged my head on something rather small till I found it in the test.

@marcus2vinicius
Copy link
Author

@Fluidbyte I seen this example, but in this case you need to save to disk before.
maybe so
http://stackoverflow.com/questions/23451726/saving-binary-data-as-file-using-javascript-from-a-browser

transform to blob

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

No branches or pull requests

2 participants