eligrey / eligrey/FileSaver.js

Downloaded PDF and Excel files are corrupted

Open
#638 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
22k
Forks
4.3k
PR merge metrics
No merged PRs in 30d

Description

I have to download files(for now only pdf /xlsx/xls) which I recieve as byte array (charset utf-8)
I saved the respective extensions in the mimetypes :
const mimeTypes = {
pdf: 'application/pdf',
xls: 'application/vnd.ms-excel;charset=utf-8',
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
};
and my saveAs function:
saveAs(new Blob([data], {type: mimeTypes[ext]}) , `${fileName}.${ext}`);

All files are getting downloaded but they are all corrupted.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.