We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

Jon B.1's avatar
Jon B.1
Collaborator | Level 9
3 years ago

SwiftyDropbox download to stream?

Hi -- I'm experimenting with developing a macOS SwiftyDropbox app which downloads and uploads encrypted files, decrypting them on the fly on the user's local machine.

 

I know there's a version of the download function which returns a DownloadRequestMemory rather than a DownloadRequestFile -- does this allow streaming to a buffer?  Is there a usage example anywhere?

  • The SwiftyDropbox SDK only provides the two download styles you mentioned: file and memory. You can find a basic example of each in the readme here.

     

    The memory option returns the file data as a Data object (in 'response.1' in the example linked above). The SDK unfortunately doesn't offer an option for returning the data as a Stream instead, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    The SwiftyDropbox SDK only provides the two download styles you mentioned: file and memory. You can find a basic example of each in the readme here.

     

    The memory option returns the file data as a Data object (in 'response.1' in the example linked above). The SDK unfortunately doesn't offer an option for returning the data as a Stream instead, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

    • Jon B.1's avatar
      Jon B.1
      Collaborator | Level 9

      Thanks -- I think it would be a very useful feature to add!

       

      Re the Data object -- is there a recommended maximum size for this kind of download, like the way uploads greater than 150Mb should be done as a session?  This will determine whether we try the Data approach and feed it through a stream, or stick with a file download and then decrypt and delete the original file.

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        There isn't a particular maximum download size recommendation in this case. (The upload request limit you mentioned is due to a particular server-side limit with respect to reliability, which doesn't apply to downloads.)

         

        So, this would be up to you, likely mainly as a matter of how much memory on the device you're willing to have the app consume for this.

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API

Make connections with other developers

795 PostsLatest Activity: 7 days ago
192 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!