Downloading files from expressJS (sendFile) server to VueJS, is returning corrupted files?
Shout out to @Helpinghand for helping me troubleshoot this.
"I found the solution within the link you posted. The problem is that i was explicitly sending params in its own object before assigning "content-type". The example you posted concatenates the query params to the url. After making this switch, its working perfectly".
this.$http.get(`http://localhost:8000/files/download?id=${item._id}`, {responseType: 'arraybuffer'}) .then(response => { console.log(response.headers.get('content-type')); console.log(response); var blob = new Blob([response.body], {type:response.headers.get('content-type')}); var link = document.createElement('a'); link.href = window.URL.createObjectURL(blob); link.download = item.filename_version; link.click(); })