-1

Using the dropbox SDK for a client side angular project. I'm able to call filesDownloadZip() but I'm not able to do anything with the result.

I'd like the browser to download the file with it's default behavior but I can't figure out how to "force" the browser to download the file.

Any ideas?

http://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesDownloadZip__anchor

Here's the function call as it exists right now. I'm not really sure what I need to do in order to force a download.

  filesDownloadZip(path){
    return dropboxSDK.filesDownloadZip({path:path}).then(x=>{
      console.log(x);
      console.log('downloaded')
    })
  }
2
  • Hello, it would be nice to know (a) what did you try?, (b) what did you get?, and (c) what were you expecting?. Any code would be essential.
    – theMayer
    Commented Jan 12, 2019 at 20:35
  • try it. stackoverflow.com/a/38523621/7291379
    – Chunbin Li
    Commented Jan 13, 2019 at 13:17

1 Answer 1

0

[Cross-linking for reference: https://www.dropboxforum.com/t5/API-Support-Feedback/Download-Entire-Folder-as-ZIP/m-p/322776/highlight/true#M18971 ]

There's an example of handling download-style requests using the Dropbox API v2 JavaScript SDK here:

https://github.com/dropbox/dropbox-sdk-js/blob/master/examples/javascript/download/index.html#L52

(Getting the data from the sharingGetSharedLinkFile method works the same way as from the filesDownloadZip method.)

In short, you can get the data from the fileBlob property of the result, and then do whatever you wish with it, such as building a download button, as shown in the example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.