Ameba Ownd

アプリで簡単、無料ホームページ作成

Filesaver angular 2 downloads corrupted file

2021.12.20 00:48






















I'm able to download the file but unable open it, because of the corruption in document. Hi Nikolaifischer, This is not working for me. I am still getting a corrupted file. I am using reactjs and below is the piece of code : server. I am also getting a corrupted excel file. API will return excel but I am not able to get a proper Excel file. Anyone can help me?


I got the solution and I put updated code in below link. To do this, navigate to the "Binary Media Types" section in the settings tab of the console. Skip to content. Star New issue. Jump to bottom. Copy link. No, it's not corrupted when writing it to a file on the server. Hello, I have the same corruption issue when writing my document.


I hope this helps! Use the correct MIME type! Big thx for the responseType hint! My long debug line ends in google. It will solve your problem. The contents of the downloaded file is garbled nonsense. We were having a similar issue and had to configure a messageConverter on the spring side.


The code snippet below is from Spring config file You still need to add the "Accept" header in the request as answered by Chris. This will help map the response to an appropriate message converter configured on the spring side.


Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Angular 2 downloading a file: corrupt result Ask Question.


Asked 5 years, 3 months ago. Active 3 years, 7 months ago. Viewed 19k times. Any help would be greatly appreciated. Dosen't seem like its a problem with saveAs A pdf format need an other format. When saving a file it shouldn't matter what type it's. The content type is only helpful for the browser to render or execute a file correctly.


Sorry, something went wrong. That's because it is So basically, you're saying that I have to find something else to convert the file to a PDF and FileSaver will just save it. Skip to content. Star 18k. New issue. Jump to bottom.