Showing results for 
Search instead for 
Did you mean: 
Update: Find information on Dropbox support during COVID-19 here
Showing results for 
Search instead for 
Did you mean: 

How to use filesDownloadZip() to download zip file in javascript SDK

Explorer | Level 3

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 unable to download the file.

I am using Node/Express Server and React on front-end.

Here's my Backend code that's interacting with api:


const downloadZip = async (req, res) => {
	 * folder_id: String
	 * team_member_id: String <Id of the member who shared the folder>

			return res.status(400).json({error: "This endpoint expects folder_id to be passed."});

			return res.status(400).json({error: "This endpoint expects team_member_id to be passed."});

		const { dbxUser } = req;
		const { folder_id } = req.body;
		const data = await dbxUser.filesDownloadZip({path: folder_id})
	} catch(error) {

And Here's my Front-end code:


onDownloadBtnClick = async () => {
            const { folder_id, shared_by: team_member_id } =;
            const { data } = await`${sharedRoute}/downloadZip`, {folder_id, team_member_id});
        } catch(error){

I've also posted this question on StackOverflow


How can I download the zip file out of this data?



1 Reply 1

Re: How to use filesDownloadZip() to download zip file in javascript SDK


If 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, '' 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:

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?