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...
Greg-DB
Dropbox Community Moderator
2 years agoTshaniii Здравко is correct; when using an access token for an app with "app folder" access, paths in your API calls are automatically interpreted relative to the app folder itself, so you shouldn't include the path to the app folder in the path value you supply.
And as Здравко said, once you have the data you can use it however you need. You may want to refer to the documentation for your platform's filesystem functionality.
- Tshaniii2 years agoHelpful | Level 5
In
await dbx.filesListFolder({ path: '' }), it prints Regulatory (which is a folder in the application folder - and the permission scope is application)but , await dbx.filesListFolder({ path: '/Regulatory' }), await dbx.filesListFolder({ path: 'Regulatory' }), await dbx.filesListFolder({ path: 'Regulatory/' }) gives 0 entries with an error like this " error: `Error in call to API function "files/list_folder": request body: path: 'Regulatory/' did not match pattern '(/(.|[\\r\\n])*)?|id:.*|(ns:[0-9]+(/.*)?)'` " .thanks also i need help with saving the downloaded file to a selected location...- Здравко2 years agoLegendary | Level 20
Tshaniii, The error, you're receiving just reflect rules that all paths, pointing file/folder in any Dropbox account, should follow to and you have violated. In particular, all paths (except the root) must start with forward slash and no any trailing slashes (both for files and folders). It may be easier to use the paths as appear in your preceding list or use the ids there; they are mandatory correct. This is valid for both downloading and listing nested folders.
Good luck.
- Greg-DB2 years ago
Dropbox Community Moderator
Tshaniii Здравко is correct, that error is indicating that you didn't provide a valid path format. It's best to take the path value from another API call result, e.g., an entry's 'path_lower' value, but if you write the path value manually it would be of the form '/Regulatory'.
When listing a folder like that, it will return an empty list of entries if the folder is empty.
The File Access Guide may be a helpful reference for how to interact with the Dropbox filesystem.
- Tshaniii2 years agoHelpful | Level 5
I added as
var dbx = new Dropbox({ accessToken: dbx_access_token , fetch});console.log(document.Folder.name);await dbx.filesListFolder({ path: `/${document.Folder.name}` }).then((response) => {console.log(response.result.entries);console.log('Files and folders in your Dropbox account:', response);response.result.entries.forEach((entry) => {console.log(entry.name, document.title);if ((entry.name).toString() === (document.title).toString()) {let file_id = entry.id;console.log(file_id);dbx.filesDownload({path: `${file_id}`}).then(async (response) => {console.log("down");await response.pipe(temporaryFileStream);}).catch((error) => {console.log(error);});}console.log(entry.name);});}).catch((error) => {console.error(error);});This code may not be correct as if the folder has subfolders it might not correctly give the entries. So please suggest me how to do this?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)I am urgent in completing this feature. Would you be able to please help me in this.
1. App permissions
2. DocFlowController is the app name
3. has 7 folders, History is one of them
4. Inside history there will be subfolders and in them there will be files. sometimes there will be no subfolders but straightaway files.
5. so i want a code to view these files in a editor or somewhere.... i prefer editor becuase there is another feature i implement to open and edit....
please give me a code sample for this. would be a great help! 🙂
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!