我是新手Node.js。我已经开始通过克隆来构建一个应用程序云数示例项目来自github https://github.com/cloudinary/cloudinary_npm。然后我将工作目录更改为 photo_album 并安装了应用程序所需的所有依赖项。然后,我根据我的要求做了一些更改,并将其制作为图像和视频库应用程序。
1. 当我尝试列出名为的文件夹中的所有图像时 我的照片 就像是云支持 https://support.cloudinary.com/hc/en-us/articles/202521082-How-to-list-all-images-within-a-folder-
cloudinary.api.resources(function(result){console.log(result)}, { type: 'upload', prefix: 'my_photos/' });
Then, I'm getting this error
/home/fw66/WebstormProjects/cloudinary_npm/samples/photo_album/node_modules/cloudinary/lib/utils.js:1023
return callback(void 0, result);
^
TypeError: object is not a function
at /home/fw66/WebstormProjects/cloudinary_npm/samples/photo_album/node_modules/cloudinary/lib/utils.js:1023:18
at IncomingMessage. (/home/fw66/WebstormProjects/cloudinary_npm/samples/photo_album/node_modules/cloudinary/lib/api.js:103:51)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:458:13)
进程已完成,退出代码为 8
我假设你正在使用cloudinary
定义为使用require('cloudinary').v2
在这种情况下,您应该使用稍微不同的语法。
本质上,回调函数应该放在最后并接收两者error
and result
参数。另请注意,一旦您提供了参数哈希,type
也必须提供。例如:
cloudinary.api.resources({type:"upload",prefix:"my_photos/"}, function(error, result){console.log(error, result)})
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)