[英]Get file uploading progress with Google Cloud Storage using NodeJS REST API
I am using @google-cloud/storage npm package for file upload from NodeJS. 我正在使用@ google-cloud / storage npm包从NodeJS上传文件。 It is uploading file to google cloud bucket successfully.
它正在成功上传文件到谷歌云桶。 Reference: https://github.com/GoogleCloudPlatform/google-cloud-node/tree/storage-1.1.0#cloud-storage-ga
参考: https : //github.com/GoogleCloudPlatform/google-cloud-node/tree/storage-1.1.0#cloud-storage-ga
But for larger files(size > 20 MB), I need to show upload progress status on browser(Client - Chrome, firefox, etc). 但对于较大的文件(大小> 20 MB),我需要在浏览器上显示上传进度状态(客户端 - Chrome,Firefox等)。
I am submitting AJAX request with file as formdata to REST API(written using NodeJS) and REST API uploads file to Google Cloud Storage buckets. 我将带有formdata文件的AJAX请求提交到REST API(使用NodeJS编写)和REST API上传文件到Google Cloud Storage存储桶。 Note: I don't want to upload files directly from UI(Browser) to Google cloud storage.
注意: 我不想直接从UI(浏览器)上传文件到Google云端存储。
But, I am not getting how to send back uploading file progress to UI from Google-Cloud-Storage via NodeJS REST API. 但是,我没有得到如何通过NodeJS REST API将文件进度从Google-Cloud-Storage发送回UI。
Would appreciate your suggestion or relevant references. 非常感谢您的建议或相关参考。
Use XMLHttpRequest to track your progress on NodeJS, using an eventlistener 使用XMLHttpRequest使用eventlistener跟踪NodeJS的进度
Open a socket and transmit progress messages from your event listener and consume them on the client 打开套接字并从事件侦听器传输进度消息,并在客户端上使用它们
References: 参考文献:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.