Download Object
This SDK method will allow you to download the object. The operation will retuen an input stream.
Parameters Used
Parameter Name | Data Type | Definition |
---|---|---|
pathToDownload | String | A mandatory parameter. Will hold the path where the object needs to be downloaded. |
newObjectName | String | An optional parameter. Will hold the name of the object that you provide while being downloaded. If you do not provide this value, then the object will be downloaded by its original name. |
versionId | String | An optional parameter. If Versioning is enabled for the bucket, it will hold the unique version ID of the required object's version. |
fromCache | Boolean |
|
progress | Function(int, int, Double)? | A callback function that can provide progess information about the object download |
copytry { ZCatalystBucket bucket = stratus.bucket("testing"); var (response, object) = await bucket.getObject("SunSet.jpeg"); final downloadsDir = await getExternalStorageDirectory(); final filePath = downloadsDir!.absolute.path; var fileResponse = await object.download( pathToDownload: filePath, onProgress: (bytesWritten, contentLength, percentage) { print("Downloaded Percentage: $percentage"); }, ); print("Download Status: ${fileResponse.statusCode}"); OpenFile.open(filePath + '/SunSet.jpeg'); } on ZCatalystException catch (ex) { print(ex.toString()); }
Last Updated 2025-07-02 15:43:56 +0530 +0530
Yes
No
Send your feedback to us
Skip
Submit