What is the difference between res.attachment
and res.download
and when to use which I am bit confused. In my case, I send my form data to the server as a JSON which will create a file out of it and respond with a download link. Which among the two: res.attachment
and res.download
should I use?
The res.attachment
"Sets the HTTP response Content-Disposition header field to “attachment”."
This essentially says, 'Hey, this file should be viewed as an attachment, not a webpage.'
Whereas the res.download
"Transfers the file at path as an “attachment”. Typically, browsers will prompt the user for download."
Find more about each HERE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With