You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

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.