我正在使用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);
});
阅读此链接:https : //blogs.dropbox.com/developers/2015/04/a-preview-of-the-new-dropbox-api-v2/
filesDownload({url:entry.path_display})传递了错误的参数。
我认为应该是{path:entry.path_display}
我实际上只是尝试过,但是我只得到文件对象,不知道如何下载文件数据。可能是因为我正在使用Electron.js
正如他们在github问题中讨论的那样:https : //github.com/dropbox/dropbox-sdk-js/issues/88
因此,您可以尝试将函数filesGetTemporaryLink({ path: entry.path_display})
用于临时链接,然后使用sharingGetSharedLinkFile({ url: res.link })
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句