How to convert binary data file to blob of png in react js

I send a request with a blob using form data:

const formData = new FormData(); formData.append("imageFile", blob, "image.png"); 

On the server where I handle that request I want it back as a blob but it’s a file that I extract from the FormData.

I wander if there’s a way I can get a blob using the file path, I get this message when trying to open it: enter image description here

Maybe I can use the buffer? I get a Buffer element when I do:

const imageFileData = fs.readFileSync(imageFile.path); 

Please help me 🙂 thanks

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.