[英]upload file from angular app to an azure function and then persist to blob storage
我想将图像上传到azure函数,并将其持久保存到azure blob存储中,但是我找不到有关如何执行此操作的任何好文章。
SOme帖子说不可能这样做,因为节点天蓝色函数存在多部分问题。
我不想让我的客户端应用知道使用哪种存储机制,所以我不想使用azure-storage-node
客户端库,因为我们将被锁定使用。
我已经试过这段代码:
const upload = multer({ storage: multer.memoryStorage() });
module.exports = function(context: Context, req: any) {
upload.any()(req, {} as any, function(err: any) {
context.log('here we are');
if (err) {
throw err;
}
context.log(req.body);
context.log(req);
console.log(req.file);
context.log(req.files);
context.done(undefined, context);
});
但是req.files是未定义的,我不得不将内容类型设置为application/octet-stream
,否则我得到了req.pipe is not a function
。
如何从azure函数将req.files
放入azure存储中?
这是一个示例GIT项目 ,该项目使用@ azure / storage-blob SDK将blob添加到Azure。 听起来好像您不想使用SDK,所以您可以查看SDK源代码并获取所需的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.