Tag: dropbox js

如何执行多个callback并返回结果数组?

我想在JSON格式的Dropbox内获取一个图像的URL数组。 为了做到这一点,我写了以下function: router.get('/thumbnails', function(req, res, next){ var images = []; var imagesCount = -1; var isLoggedIn = !!req.user; var dropboxClient = req.app.get('dropboxClient'); console.log(dropboxClient); dropboxClient.authenticate({interactive: false}, function(error, client) { if (error) { console.log(error); return 0 } if (dropboxClient.isAuthenticated()) { dropboxClient.readdir(dropboxConfig.folder, function(error, entries) { if (error) { console.log(error); return 0 } imagesCount = entries.length; entries.forEach(function(entry){ var path […]