In a versioning-enabled bucket, different versions of the objects may have different storage classes. By default, the RestoreObject operation restores the current version of an object. To restore a specific version of the object, specify the version ID.

The following code provides an example on how to restore an object:

const OSS = require('ali-oss');

const client = new OSS({
  bucket: '<Your BucketName>',
  // The endpoint of the China (Hangzhou) region is used in this example. Specify the actual endpoint.
  region: '<Your Region>',
  // Security risks may arise if you use the AccessKey pair of an Alibaba Cloud account to log on to OSS because the account has permissions on all API operations. We recommend that you use your RAM user's credentials to call API operations or perform routine operations and maintenance. To create a RAM user, log on to the RAM console.
  accessKeyId: '<Your AccessKeyId>',
  accessKeySecret: '<Your AccessKeySecret>'
});

const name = '<your objectName>'
// Restore the object with the specified version ID.
const versionId = 'your versionId' 
async function restore() {
  const result = await client.restore(name, {
    versionId
  });
  console.log(result);
}

restore();