Download an Object From a Bucket

To download an object from the bucket:

  1. Click or select the required object.

    catalyst_stratus_object_options
  2. Click Download.

    catalyst_stratus_download_highlit
  3. Click Save in your system prompt.

    catalyst_stratus_object_save_to_local

The object will be downloaded to your local system.

You can also download the object using the Download button present in the object details view.

catalyst_stratus_download_highlit_inside
Note: Visit this help document for more information on this SDK method.

Ensure the following packages are imported

    
copy

import com.zc.component.stratus.beans.ZCGetObjectOptions; import java.nio.file.Path; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.io.*;

    
copy

InputStream dataStream = bucket.getObject(“objectName”); // download the object to your local machine Path path = Path.of(“file_path”); // specify a path to store the downloaded object Files.copy(dataStream, path, StandardCopyOption.REPLACE_EXISTING);

Note: Visit this help document for more information on this SDK method.
    
copy

const res = await bucket.getObject(“objectName”); // download the object to local machine const files = fs.createWriteStream(‘filePath’); res.on(‘data’, (data) => { files.write(data) });

Note: Visit this help document for more information on this SDK method.
    
copy

res = bucket.get_object(‘object_name’) # download the object to local machine file = open(‘file_path’,‘wb’) file.write(res)

Note: Visit this help document for more information on this SDK method.
    
copy
objectInstance.download(fromCache : true) {
result in switch result {
    case.success(let url):
    do {
        let data = Data(contentsOf : url) DispatchQueue.main.sync {
        self.imageView.image = UIImage(date : data)
        }
    }
    catch {
        print("Error : \( error )")
    }
    case.error(let error):
    print("Error : \( error )")
}
}
Note: Visit this help document for more information on this SDK method.
    
copy
bucketInstance.getObject("SunSet.jpeg", "2823000000044005", //Replace this with your Folder ID and File ID
    {
object->object.download({println("File download success ${it.available()}")},
                        {println("File download failed $it")})
Note: Visit this help document for more information on this SDK method.
    
copy
try {
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-06-03 18:19:55 +0530 +0530