Cloudinary node.js上传进度 [英] Cloudinary node.js progress of uploading

查看:88
本文介绍了Cloudinary node.js上传进度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在angularjs Web SPA中使用cloudinary,并且有一个名为 .progress 的不错的回调:

I used cloudinary in angularjs web SPA and there was nice callback named .progress:

.progress(function (info) {
    //file.progress = Math.round((e.loaded * 100.0) / info.total);
    //file.status = "Uploading... " + file.progress + "%"
    console.log(info);
})

基本上是用有关状态信息的数据记录对象。

which was basically logging object with data about uploading status info.

现在我想知道是否能够以某种方式在服务器端通过nodeJS代码上传时获得相同的进度

Now I'm wondering if I'm able to somehow get same progress when uploading by nodeJS code on server side

cloudinary.v2.uploader.upload(path, { resource_type: "video" }, function(err, success) {
    console.log('err: ' + JSON.stringify(err));
    console.log('suc: ' + JSON.stringify(success.secure_url));
});

我正在使用电子设备,因此我可以通过ipcMain与nodeJS前端进行通信我可以从发送自定义事件节点到前面,所以我可以每上传1%传递一次新事件,并在前面显示一些进度栏。

I'm using electron so I can communicate nodeJS side with front with ipcMain I can send custom event from node to front so I can just pass new event every 1% of uploading and display some progressbar on front.

但是由于cloduinary文档没有提供有关如何操作的其他信息要获取使用nodejs上传的状态,我不知道该怎么做以及是否可行。

But since cloduinary docs doesn't provide some additional info of how to get status of uploading with nodejs I don't know how to do that and if it is possible.

推荐答案

谷歌搜索,我从cloudinary合作者那里找到了有关github上的信息,该进展不适用于服务器侧面上传。

After much more googling I found information on github from cloudinary collaborator that progress isn't available for server-side uploading.

这篇关于Cloudinary node.js上传进度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆