Im trying to download a pdf file stored in mongodb using gridfs andmulter , I am recieving a stream back which when I downloaded and open the pdf file would be corrupted here is my backend for downloading it [My backend is node js and frontend is react js ].
here is my backend code
here is my frontend code
here is the response that i recieved
this is what the response.data would look like
lastly this is what the error looks like when I opened one of those downloaded files
please do help me out ive been struggling in the past two days to find a solution to this