问题
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.
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));
});
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.
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.
回答1:
After much more googling I found information on github from cloudinary collaborator that progress isn't available for server-side uploading.
来源:https://stackoverflow.com/questions/51573300/cloudinary-node-js-progress-of-uploading