Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 我想通过NodeJS Express应用程序将Azure blob存储与Angular应用程序连接_Node.js_Angular_Express_Azure Blob Storage - Fatal编程技术网

Node.js 我想通过NodeJS Express应用程序将Azure blob存储与Angular应用程序连接

Node.js 我想通过NodeJS Express应用程序将Azure blob存储与Angular应用程序连接,node.js,angular,express,azure-blob-storage,Node.js,Angular,Express,Azure Blob Storage,我真正想做的是,我不想让文件直接从angular web应用上传到Azure blob存储。相反,我想首先通过express API将上传的文件发送到NodeJS应用程序,然后从他们那里上传到azure应用程序,如果我真的可以这样做的话。我不认为直接从angular web应用程序上载文件是安全的,因为它将显示我的azure blob存储凭据,这就是我希望通过NodeJS应用程序上载文件的原因。 如果这个问题有解决办法,请告诉我。 或者如果解决方案有点不同但安全,那么我还是想知道它。 并分享我可

我真正想做的是,我不想让文件直接从angular web应用上传到Azure blob存储。相反,我想首先通过express API将上传的文件发送到NodeJS应用程序,然后从他们那里上传到azure应用程序,如果我真的可以这样做的话。我不认为直接从angular web应用程序上载文件是安全的,因为它将显示我的azure blob存储凭据,这就是我希望通过NodeJS应用程序上载文件的原因。 如果这个问题有解决办法,请告诉我。 或者如果解决方案有点不同但安全,那么我还是想知道它。 并分享我可以在哪里获得演示代码


流程如下:angular应用程序将数据作为数据流传递给api。API随后会将其存储到您在Azure Config details中配置的位置上的blob中。

如果您已经或已经看到该类型任务的一些工作代码,请提供这些代码,我实际上并不理解“API的数据作为数据流”的含义,您的意思是enctype=“multipart/form data”?是的。这就是从前端发送它的方式:UploadDocument(formData){let options={headers:new HttpHeaders({'Authorization':'Bearer'+This.localStorageService.getValue('access_token')});返回This.http.post(This.apirl+'/api/Documents/UploadDocuments',formData,options)}var stream=require('stream');var azure=require('azure-storage');var fileService=azure.createFileService();var fileStream=new stream.Readable();fileStream.push(myFileBuffer);fileStream.push(null);fileService.createFileFromStream('taskshare','taskdirectory','taskfile',fileStream,myFileBuffer.length,函数(错误、结果、响应){if(!error){//file upload}});第一条注释来自Angular Frontend,第二条是来自nodejs的示例代码。