After receiving a http request containing as parameter a base64 string of a photo, I want to save the file of this photo in my workspace. I runned the code below, it works without any error, but there is no photo stored in the path mentioned.
const name = req.body.name;
var base64Str = mainImage.replace(/^data:image\/jpeg;base64,/, "");
var optionalObj = {'fileName': name, 'type':'jpeg'};
base64toimage(mainImage,path.join(__dirname,'../../static/images/${name}.jpeg'),optionalObj);
What can be the problem ?