kennethjiang/js-file-download

Trying to download PDF file but Failed to load PDF

Closed this issue · 2 comments

I try to download the file in react using Axios but it failing in both conditions.

add { responseType: 'blob' } to Axios and added fileDownload(res.data, fileName); but it gives Failed to load PDF document.

Removed { responseType: 'blob' } to Axios and added fileDownload(res.data.body, fileName); but its gives blank file with no content.
I am using Nodejs as backend with sending response in fs.createReadStream() and pipe()

Hey @theromie. Could you post a small repo that reproduces the problem?

@motevets I solve this issue. It was some error in the backend.