Updated on 2026-01-16 GMT+08:00

Downloading an Object

This example downloads object objectname from bucket bucketname.

The example code is as follows:

obsClient.getObject({
       Bucket : 'bucketname',
       Key : 'objectname'
}, function (err, result) {
       if(err){
              console.error('Error-->' + err);
       }else{
              console.log('Status-->' + result.CommonMsg.Status);
              if(result.CommonMsg.Status < 300 && result.InterfaceResult){
                     console.log(result.InterfaceResult.Content);
              }
       }
});