Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
zainulabd786
7 years agoExplorer | Level 3
How to use filesDownloadZip() to download zip file in javascript SDK
I want to download the folder in my dropbox as a zip file. I am using JavaScript SDK. I know there's filesDownloadZip() available for that.
I am able to get the Binary data from API, But still una...
Greg-DB
Dropbox Community Moderator
7 years agoIf you want to get a zip of a folder on Dropbox, the 'filesDownloadZip' method you already found is the right method. (If you only wanted a single file, you would use the 'filesDownload' method.
In either case, when performing a download call like this in Node, if the call succeeds the resulting data is in the 'fileBinary' field. (If running in browser JavaScript, it would be in the 'fileBlob' field.)
In the case of using 'filesDownloadZip', that data is the actual raw data for the zip file containing the requested folder.
It looks like you have the Dropbox part of this itself working, so I don't think I can offer to much help with the part that you're currently stuck on. Exactly what you do with that returned data and how you serve it back to the user is up to and will depend on the web framework you're using in this case.
That said, I wouldn't expect to use '.json()' or 'JSON.stringify' on the returned data, as it's not an object you necessarilly want to convert into a JSON string. Also, 'window.open' doesn't seem right as that would expect a URL, but the data isn't a URL.
You should look into how to send a Buffer from your Node backend to the client. For example, here's a question on StackOverflow that looks similar: https://stackoverflow.com/questions/25206141/having-trouble-streaming-response-to-client-using-expressjs
About Discuss Dropbox Developer & API
Make connections with other developers
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!