--- title: "Download Object" url: https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/stratus/download-object/ description: "This page lists the Node.js SDK method to download objects from a bucket." last_updated: 2026-09-08T11:07:33Z service: Cloud Scale type: general related_links: - name: "Stratus Component Help Documentation" url: /en/cloud-scale/help/stratus/introduction - name: "Download Object Help Documentation" url: /en/cloud-scale/help/stratus/objects/manage-object/download-object/ - name: "Java SDK" url: /en/sdk/java/v1/cloud-scale/stratus/download-object/ - name: "Python SDK" url: /en/sdk/python/v1/cloud-scale/stratus/download-object/ - name: "JavaScript SDK Documentation" url: /en/sdk/javascript/v1/cloudscale/stratus/rename-move/ - name: "iOS SDK" url: /en/sdk/ios/v2/cloud-scale/stratus/download-object/ - name: "Android SDK" url: /en/sdk/android/v2/cloud-scale/stratus/download-object/ - name: "Flutter SDK" url: /en/sdk/flutter/v2/cloud-scale/stratus/download-object/ - name: "REST API" url: /en/api/code-reference/cloud-scale/stratus/get-all-buckets/#GetAllBuckets --- # Download Object > **Note:** This SDK is currently in deprecation. Migrate to [JavaScript SDK](https://docs.catalyst.zoho.com/en/sdk/javascript/v1/cloudscale/stratus/download-object/) now. ### Download an Object The SDKs present in the section will allow you to [download a particular object](https://docs.catalyst.zoho.com/en/cloud-scale/help/stratus/objects/manage-object/download-object/), multiple objects, or version of the object. The Bucket reference used in the below code snippet is the [component instance](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/stratus/create-bucket-instance/). The first step of the download operation is a `GET` operation that retrieves the required object from the bucket. To be able to download an object, the requester must have `READ` access permissions. However, owners of the bucket do have the option to grant `READ` access permissions to users, allowing them to download the object without using the required response headers. If [Versioning](https://docs.catalyst.zoho.com/en/cloud-scale/help/stratus/stratus-config/general-settings/#versioning) is enabled for your bucket, you need to pass the `versionId` to download the particular version of the object. If no `versionId` is passed, then by default, the latest version of the object will be downloaded. If *Versioning* was enabled for a bucket, then disabled. By default, the principal first object will be downloaded. To ensure you download the latest version of this object, you need to pass the `versionId` param with the value "`topVersion`". ```javascript const res = await bucket.getObject("sam/out/sample.txt"); // download the object to local machine const files = fs.createWriteStream('filePath'); res.on('data', (data) => { files.write(data) }); ``` ### Download a Portion of the Object The following SDK method is used with the `range` parameter. The range parameter allows you to download a specific `range` of bytes of an object. ```javascript const options = { 'versionId': 'djkshr8374yiuhf48', // download the object with given versionId 'range': '0-2000' // start and end range of the object in bytes } const res = await bucket.getObject("sam/out/sample.txt", options); // download the object to your local machine const files = fs.createWriteStream('filePath'); res.on('data', (data) => { files.write(data) }); ``` ### Download an Object Using Transfer Manager In this section, we are going to go over SDK methods that will allow you to successfully download large objects from Stratus to your local system using **Transfer Manager** technique. Transfer Manager is an operation where the large object is split into multiple byte ranges using the start and end bytes range of the object. Each of the object's parts is then returned as a stream, and they are downloaded to your local system. **Ensure the following packages are imported** ```javascript const { TransferManager } = require('zcatalyst-sdk-node/lib/stratus'); ``` #### Create Transfer Manager Instance ```javascript const transferManager = new TransferManager(bucket); // create transfer manager instance ``` #### Download Object as Iterable Part Streams ```javascript const partSize=50; const getObjectRes = await transferManager.getIterableObject("sam/out/sample.txt",partSize); // download the object to local machine const file = fs.createWriteStream('filePath'); // create a file write stream for await (const chunk of getObjectRes) { file.write(chunk); } ``` #### Generate Object Parts for Download In this SDK method we will download a portion of the object that falls under the required start and end range of bytes. ```javascript const file = fs.createWriteStream("filePath"); const partSize = 50; const downloadRes = await transferManager.generatePartDownloaders("sam/out/sample.txt", partSize); let partNum = 0; while (partNum < downloadRes.length) { const objectPart = downloadRes[partNum++]; const buffer = await objectPart(); // return the object part as stream // process the stream } ``` ### Generate Presigned URL to Download an Object Presigned URLs are secure URLs that authenticated users can share to their non-authenticated users. This URL will provide non-authenticated users with temporary authorization to access objects. The Bucket reference used in the below code snippet is the [component instance](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/stratus/create-bucket-instance/). > **Info:** To use this SDK method, you need intialize it with **Admin** scope. You can learn more about this requirement from this [section](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/overview/#initialize-sdk-with-scopes) **Parameters Used**
Parameter Name Data Type Definition
`key` **String** A **Mandatory** parameter. Will hold the complete name of the object along with it's [path](https://docs.catalyst.zoho.com/en/cloud-scale/help/stratus/objects/introduction/#path).
`urlAction` **Request Method** A **Mandatory** parameter. This is the parameter that will allow you to generate a presigned URL for either a download(GET) action.
  • `GET`: To download an object
`expiry` **String** This is an **Optional** parameter. The URL validity time in seconds.
  • Default value: **3600 seconds**
  • Minimum value: **30 seconds**
  • Maximum value: **7 days**
`activeFrom` **String** This is an **Optional** parameter. This param will contain the time after which the URL is valid. Maximum value is **7 days**. URLs are made active as soon as they are generated by default.
```javascript const signedURLRes = await bucket.generatePreSignedUrl("sam/out/sample.txt", 'GET', { 'expiryIn': 100, // expiry time in seconds 'activeFrom':'12334454327', // activate the url in the given date 'versionId': '746398diij94839' }); console.log(signedURLRes); ``` **Example Response for Generating a Presigned URL for Download** ```json { "signature": "https://sadi-development.zohostratus.com/_signed/text.txt?organizationId=96862383&stsCredential=96858154-96862383&stsDate=1747898364894&stsExpiresAfter=300&stsSignedHeaders=host&stsSignature=SFdW4woI5nXPCSCghrymsv06hM0cimwZpkFwHWngtto", "expiry_in_seconds": "100", "active_from": "12334454327" } ``` **Example Snippet Illustrating Usage of Presigned URL to Download an Object** > **Info:** This example is shown using **Axios** request handler package. ```javascript const axios = require('axios'); const fs = require('fs'); // Replace with the actual pre-signed URL for your file. const url = 'https://sadi-development.zohostratus.com/_signed/text.txt?organizationId=96862383&stsCredential=96858154-96862383&stsDate=1747898364894&stsExpiresAfter=300&stsSignedHeaders=host&stsSignature=SFdW4woI5nXPCSCghrymsv06hM0cimwZpkFwHWngtto'; (async () => { try { // Send GET request to download file as a stream const response = await axios.get(url, { responseType: 'stream' }); // Create a writable stream to save the file locally const file = fs.createWriteStream('file_path'); // Replace with desired output path // Pipe the response stream to the file stream response.data.pipe(file); // Notify when the file has been downloaded file.on('finish', () => { console.log('File downloaded successfully'); }); // Handle any errors during writing file.on('error', (err) => { console.error('Error writing file:', err); }); } catch (err) { console.error('Error downloading file:', err); } })(); ```