无法完成从nodeJS上传视频到cloudinary

Unable to complete uploading video to cloudinary from nodeJS

我执行这段代码:

var path = __dirname + '\videos\example.webm';
console.log(path);
cloudinary.uploader.upload(path, { resource_type: "video" }, function(success, err) {
    console.log('suc: ' + success);
    console.log('err: ' + err)
});

行为是它控制台记录 800KB .webm 文件的正确路径

C:\Users\Borys\Documents\igt\desktopApp\videos\example.webm

然后什么也没发生。它不再控制台记录更多信息。我没有收到任何错误。

我正确地要求 cloudinary 类 并且我正确地设置配置(在上面的代码之前)

const cloudinary = require('cloudinary');

cloudinary.config({
    cloud_name: 'myappname',
    api_key: 'my keys',
    api_secret: 'my keys'
});

为什么什么都没发生?

你的电话是这样的:

cloudinary.uploader.upload(path, options, callback);

这是不正确的。

正在寻找 here, callback should be the second argument, not the third. If you need to pass in additional options into that function, you must use this 来电:

cloudinary.v2.uploader.upload(path, options, callback);

注意方法链中的 v2