Learn how to make the most out of the Dropbox Community here 💙!

Forum Discussion

lekn's avatar
lekn
Explorer | Level 3
5 years ago
Solved

Downloading zip files from Dropbox via API returns size zero

Hi,   I was trying to download zip files within a folder from my dropbox. For example, there are 7z files named 0.7z, 1.7z, ... 5.7z under folder name 'extra'. I could download the 7z files v...
  • Greg-DB's avatar
    Greg-DB
    5 years ago

    Apologies, I had the wrong link in that post. I just fixed it. It should be this post.

     

    Anyway, it looks like the issue is that you're running out of memory when downloading the file, since you're accessing the whole thing, and the file is very large.

     

    You can read off the download result in pieces like this:

    with open(new_file_path, 'wb') as new_file:
        for chunk in res.iter_content(chunk_size=4*1024*1024):  # or whatever chunk size you want
            new_file.write(chunk)

    (Note I also changed the file open mode to binary mode.)

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,972 PostsLatest Activity: 24 hours ago
366 Following

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 or Facebook.

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!