Download response from backend


'/test',{},{headers: {'Content-Type': 'arraybuffer' }}).then(response=>{
         let blob = new Blob([],{ type:'application/pdf'});
        let link = document.createElement('a');
        link.href = window.URL.createObjectURL(blob); = "next1234.pdf";;

backend for it

 res.sendFile(__dirname +'/x.pdf')

it get downloaded but not working file showing damaged
it works fine for postman.

any one help me please?


Please don’t ping members in your post initially like this, hoping to get an immediate response like this. This is poor and rude forum etiquette. If Linus knows and can, he will on his own accord.


ok. I removed it.


any solution with this problem?


The Content-Type seems invalid. Try:
responseType: ‘arraybuffer’,
headers: {
‘Accept’: ‘application/octet-stream’,