box / box-android-sdk

Apache License 2.0
62 stars 74 forks source link

Download specific file version #418

Closed fistuk closed 4 years ago

fistuk commented 4 years ago

Im trying to download a specific version of a file. For java SDK it may be done as follows:

BoxFile file = new BoxFile(api, "id");
List<BoxFileVersion> versions = file.getVersions();
BoxFileVersion firstVersion = versions.get(0);

FileOutputStream stream = new FileOutputStream(firstVersion.getName());
firstVersion.download(stream);
stream.close();

With Android SDK I'm doing the following: fileApi.getDownloadRequest(outputStream, id).send()

Didn't find a way to download a specific version.

fistuk commented 4 years ago

Its possible to set version on the download request:

fileApi.getDownloadRequest(outputStream, id).setVersion(versionId)
                .setProgressListener { numBytes, totalBytes ->

                }
PJSimon commented 4 years ago

Hey @fistuk, closing this at it appears you've resolved it. Thanks for sharing your findings here! If you need anything else, please feel free to open another issue or re-open this one!

Thanks!