新问题
当我覆盖 blob 然后更新时,浏览器仍在缓存主图像而不是新图像。我读过有一个缓存控制属性,但我无法实现它。我需要清理刚刚上传的 blob 缓存
老问题
我正在尝试使用 connect-busboy 中间件和以下方法覆盖现有的 blob,但该文件没有被覆盖,我不明白为什么。
createBlockBlobFromStream(container, blob, (Stream), streamLength,
options, callback) → {SpeedSummary}从流中上传块 blob。如果服务上已经存在 blob,它将被覆盖。
app.post('/upload', function(req, res, params) {
var name;
req.busboy.on('field', function (fieldname, val) {
name = val+'.jpg';
});
req.busboy.on('file', function (fieldname, file, filename, encoding, mimetype) {
file.on('data', function (data) {
console.log(name);
console.log(data);
var bufferStream = new stream.PassThrough();
bufferStream.end(data);
var blobSvc = azure.createBlobService(accountName, accountKey);
blobSvc.createBlockBlobFromStream('images', name, bufferStream, data.length, function (error, result, response){
if (!error) {
res.send(200,'upload succeeded')
} else {
res.send(500,JSON.stringify(error))
}
})
});
});
});