I'm trying to save images to storage, the whole process happens smoothly, until the time I'm going to look at the storage and:
This is my script
const blobSvc = azure.createBlobService(config.containerConnectionString);
let filename = guid.raw().toString() + '.jpg';
let rawdata = req.body.image;
let matches = rawdata.match(/^data:([A-Za-z-+\/]+);base64,(.+)$/);
if (matches) {
var type = matches[1];
var buffer = new Buffer(matches[2], 'base64');
}
await blobSvc.createBlockBlobFromText('product-images', filename , buffer, {
contentType:type
}, function(error, result, response) {
if (error) {
filename = 'default-product.png';
console.log(error);
}else{
console.log(result)
}
});
Does anyone know what's going on and how to solve it?