Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Tshaniii
2 years agoHelpful | Level 5
dropbox file download - dbx.filesDownload
var dbx = new Dropbox({ accessToken: dbx_access_token , fetch}); await dbx.filesDownload({ path: dbx_path }).then(async (response) => { console.log("down"); awa...
Tshaniii
2 years agoHelpful | Level 5
var dbx = new Dropbox({ accessToken: dbx_access_token , fetch});
console.log(document.Folder.name);
await dbx.filesListFolder({ path: `/${document.Folder.name}` })
.then(async (response) => {
console.log(response.result.entries);
console.log('Files and folders in your Dropbox account:', response);
response.result.entries.forEach(async (entry) => {
console.log(entry.name, document.title);
if ((entry.name).toString() === (document.title).toString()) {
let file_id = entry.id;
console.log(file_id);
await dbx.filesDownload({
path: `${file_id}`
}).then( (response) => {
console.log("down");
const data = response.result.fileBinary;
fs.writeFile(filename, data, (err) => {
if (err) throw err;
console.log('File saved!');
});
}).catch((error) => {
console.log(error);
});
}
console.log(entry.name);
});
})
.catch((error) => {
console.error(error);
});
return successMessage(res, 'Document viewed successfully');
} catch (err) {
next(err);
}
};
so this is all i have in my code and the error i get is ,
TypeError: res.buffer is not a function
at D:\GitHubProjects\docMgtSys\document-management-system\node_modules\dropbox\cjs\src\response.js:67:11
at new Promise (<anonymous>)
at parseDownloadResponse (D:\GitHubProjects\docMgtSys\document-management-system\node_modules\dropbox\cjs\src\response.js:61:10)
at D:\GitHubProjects\docMgtSys\document-management-system\node_modules\dropbox\cjs\src\dropbox.js:146:52
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async D:\GitHubProjects\docMgtSys\document-management-system\controllers\document-controller.js:170:11
at D:\GitHubProjects\docMgtSys\document-management-system\node_modules\dropbox\cjs\src\response.js:67:11
at new Promise (<anonymous>)
at parseDownloadResponse (D:\GitHubProjects\docMgtSys\document-management-system\node_modules\dropbox\cjs\src\response.js:61:10)
at D:\GitHubProjects\docMgtSys\document-management-system\node_modules\dropbox\cjs\src\dropbox.js:146:52
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async D:\GitHubProjects\docMgtSys\document-management-system\controllers\document-controller.js:170:11
when i use I get error: `Error in call to API function "files/list_folder/continue": request body: unknown field 'path'`
await dbx.filesListFolderContinue({ path: `/${document.Folder.name}` }),
Greg-DB
Dropbox Community Moderator
2 years agoIt's still not clear where the "TypeError: res.buffer is not a function" path is coming from; that doesn't reproduce for me when I run this, so it may be something specific to your environment. I recommend referring to your platform's documentation.
As for the "Error in call to API function "files/list_folder/continue": request body: unknown field 'path'" error, that's because you're supplying a "path" parameter to the filesListFolderContinue method, however that method doesn't accept a "path" parameter. It only accepts a "cursor" parameter. Please refer to the filesListFolder and filesListFolderContinue documentation for information on how to use these methods.
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!