2016-08-23 63 views
1

我使用node.js和保管箱包从文件夹下载文件。我能够验证并列出文件,但不能下载它们。我希望能够下载没有共享的文件。从保管箱文件夹下载文件

 client.filesListFolder({ path: directory }) 
    .then(function (response) { 
     response.entries.forEach(function (entry) { 
      if (entry[".tag"] === "file") { 
       client.filesDownload({ url: entry.path_display}) 
        .then(function (data) { 
         // ... 
        }) 
        .catch(function (err) { 
         throw err; 
        }); 
      } 
     }); 
    }) 
    .catch(function (err) { 
     me.ThrowError(null, err.status, err.error); 
    }); 
+1

它看起来就像你使用[dropbox-sdk-js](https://github.com/dropbox/dropbox-sdk-js)并且已经找到['filesDownload'](https://dropbox.github.io/ dropbox-sdk-js/Dropbox.html#filesDownload)方法。什么是不正确的工作?你有错误吗? – Greg

回答

0

阅读此链接: https://blogs.dropbox.com/developers/2015/04/a-preview-of-the-new-dropbox-api-v2/

filesDownload(网址:{url:entry.path_display})传递一个错误的ARG。

我觉得应该是{路径:entry.path_display}

我其实只是尝试过,但我只得到文件对象,我不知道如何让文件数据被下载。这可能是因为我使用Electron.js

在他们的GitHub的问题讨论: https://github.com/dropbox/dropbox-sdk-js/issues/88

因此,你可以尝试使用功能filesGetTemporaryLink({ path: entry.path_display})到一个临时链接,然后使用sharingGetSharedLinkFile({ url: res.link })

相关问题