'Saving React Blob Images in Node Not Working

Here is images coming in request ( from react app)

req.body = {
  imageData: [ 'blob:http://localhost:3000/0bdca87f-47dc-4e56-94ae-ea24e86b6530' ]
}

Now I need to save this on ImageKit ( Node.Js)

imagekit 
    .upload ({
      file : req.body.imageData[0], // not working
     // file : 'convert_blob_to_base64' // not working either
      fileName: 'my_file_name1.jpg'
      
    })
    .then (response => {
      console.log (response);
    })
    .catch (error => {
      console.log (error);
    });

It does save the image but corrupted one, I tried by converting blob to base64, then also it didn't worked out.

if I directly convert the image to base64 using https://www.base64encode.org/ site and use that code as file : 'base_64_directly_encoded_image' then it works

Do I need to store the images first on Node. Js Something, Can Any one guide please.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source