Hello, I having BIG issues sending file from my server to my client. Here's is what I'm doing:- on client side, I send the file object that multer download.- upon downloading on the server side, I read the file in HEX with fs and store the buffer as varbinary in my database using mssql, then delete the temporary file.That part above is working.Then when I make a get request to get the file and use it on my web app (webviewer, user icon, etc), mssql returns me a buffer for the varbinary column. This is where I'm lost. I don't know how to reconstruct the file from that buffer. Here's what I attempted:- sending the file in different format (binary, utf 8, hex,...) as string and trying to rewrite it on the client side in a new buffer, from which I would create a blob- sending the buffer containing the file with the content-type header set to its mime-type, then using a ReadableStream to write the file into a blobThe best I got was a corrupted file displaying gibberish and nonsense... I desperately need help, I have lost days on that and I'm making 0 progress... I've been searching again and again but it's like no one ever did what I'm trying to do, so I'm picking from solutions to other problems but it didn't work too well for me so far...
Submitted July 27, 2020 at 10:52AM by ArutanSipdrae
No comments:
Post a Comment