I'm trying to get the blob of a Discord message attachment, every time I try an axios request to the CDN, it gets a corrupted blob, however the CDN still lets me download the normal file whenever I go to it.
If this helps this is the file I tried
Raw Upload: https://cdn.discordapp.com/attachments/1057112589596889108/1057113515313352704/robloxmodelfile.rbxm
What Axios Gets https://drive.google.com/file/d/179HKmW2gwGJZmzJYBfDZ3kT2Z15SjD0t/view?usp=sharing (Sorry I can't upload files to stack overflow)
The after file is about 100kb bigger, which is confusing. This isn't a database problem because I've tried just turning the blob straight back into an attachment and sending it back, it's still always a bigger file and never opens. However they look similar in notepad++
This is how I get the attachment:
let file = await axios({
url: 'https://cdn.discordapp.com/attachments/1057112589596889108/1057113515313352704/robloxmodelfile.rbxm',
method: 'GET',
responseType: 'blob',
}).then((response) => {
return response.data
});
ResponseType 'blob'
only works on browser axios, use arraybuffer
instead.