Hi! I'm currently using FileSaver ^2.0.5, and my use case is for my react app to fetch an encrypted blob (from a server that's not owned by us), decrypt it, then allow the user to download the file.
For files like .txt and .xlsx, it seems to work just fine. Trying .xlsx and .pdf results in a larger than expected file size (which I've observed to be after converting the file to a blob) and results in the downloaded file becoming corrupted.
Further, in my case, I'm unable to allow users to download directly from my server because the encryption process has to be done client-side and the decrypted file should not reach any server. I've also tried alternative ways like creating a <a></a> element in the DOM to manage the download but it fails as well.
Hi! I'm currently using FileSaver
^2.0.5
, and my use case is for my react app to fetch an encrypted blob (from a server that's not owned by us), decrypt it, then allow the user to download the file.Here is how I'm fetching the encrypted blob:
And here is how I'm decrypting it and managing the download:
For files like
.txt
and.xlsx
, it seems to work just fine. Trying.xlsx
and.pdf
results in a larger than expected file size (which I've observed to be after converting the file to a blob) and results in the downloaded file becoming corrupted.Further, in my case, I'm unable to allow users to download directly from my server because the encryption process has to be done client-side and the decrypted file should not reach any server. I've also tried alternative ways like creating a
<a></a>
element in the DOM to manage the download but it fails as well.Any help is greatly appreciated! :)