ali-sdk / ali-oss

Aliyun OSS(Object Storage Service) JavaScript SDK for the Browser and Node.js
https://www.alibabacloud.com/help/doc-detail/52834.htm
MIT License
1.94k stars 578 forks source link
alibabacloud aliyun aliyun-oss javascript oss sdk

oss-js-sdk

NPM version build status coverage David deps

aliyun OSS(Object Storage Service) js client for Node and Browser env.

NOTE: For SDK 5.X document, please go to README.md

Install

npm install ali-oss --save

Compatibility

Node

Node.js >= 8.0.0 required. You can use 4.x in Node.js < 8.

Browser

Note:

QA

You can join DingDing Talk Group, Group Link

License

MIT

OSS Usage

OSS, Object Storage Service. Equal to well known Amazon S3.

All operation use es7 async/await to implement. All api is async function.

Summary

Node Usage

Compatibility

Basic usage

1.install SDK using npm

npm install ali-oss --save

2.for example:

const OSS = require('ali-oss');
const store = new OSS({
  region: '<oss region>',
  accessKeyId: '<Your accessKeyId>',
  accessKeySecret: '<Your accessKeySecret>',
  bucket: '<Your bucket name>'
});

Browser Usage

You can use most of the functionalities of ali-oss in browser with some exceptions:

Compatibility

Setup

Bucket setup

As browser-side javascript involves CORS operations. You need to setup your bucket CORS rules to allow CORS operations:

STS setup

As we don't want to expose the accessKeyId/accessKeySecret in the browser, a common practice is to use STS to grant temporary access.

Basic usage

Include the sdk lib in the <script> tag and you have OSS available for creating client.

// x.x.x The specific version number represented // we recommend introducing offline resources, because the usability of
online resources depends on the stability of the cdn server.
<!-- Introducing online resources -->
<script src="http://gosspublic.alicdn.com/aliyun-oss-sdk-x.x.x.min.js"></script>
<!-- Introducing offline resources -->
<script src="https://github.com/ali-sdk/ali-oss/raw/master/aliyun-oss-sdk-x.x.x.min.js"></script>

<script type="text/javascript">
  const store = new OSS({
    region: 'oss-cn-hangzhou',
    accessKeyId: '<access-key-id>',
    accessKeySecret: '<access-key-secret>',
    bucket: '<bucket-name>',
    stsToken: '<security-token>'
  });

  store
    .list()
    .then(result => {
      console.log('objects: %j', result.objects);
      return store.put('my-obj', new OSS.Buffer('hello world'));
    })
    .then(result => {
      console.log('put result: %j', result);
      return store.get('my-obj');
    })
    .then(result => {
      console.log('get result: %j', result.content.toString());
    });
</script>

The full sample can be found here.

How to build

npm run build-dist

And see the build artifacts under dist/.

Data Regions

OSS current data regions.

region country city endpoint internal endpoint
oss-cn-hangzhou China HangZhou oss-cn-hangzhou.aliyuncs.com oss-cn-hangzhou-internal.aliyuncs.com
oss-cn-shanghai China ShangHai oss-cn-shanghai.aliyuncs.com oss-cn-shanghai-internal.aliyuncs.com
oss-cn-qingdao China QingDao oss-cn-qingdao.aliyuncs.com oss-cn-qingdao-internal.aliyuncs.com
oss-cn-beijing China BeiJing oss-cn-beijing.aliyuncs.com oss-cn-beijing-internal.aliyuncs.com
oss-cn-shenzhen China ShenZhen oss-cn-shenzhen.aliyuncs.com oss-cn-shenzhen-internal.aliyuncs.com
oss-cn-hongkong China HongKong oss-cn-hongkong.aliyuncs.com oss-cn-hongkong-internal.aliyuncs.com
oss-us-west-1 US Silicon Valley oss-us-west-1.aliyuncs.com oss-us-west-1-internal.aliyuncs.com
oss-ap-southeast-1 Singapore Singapore oss-ap-southeast-1.aliyuncs.com oss-ap-southeast-1-internal.aliyuncs.com

Create Account

Go to OSS website, create a new account for new user.

After account created, you can create the OSS instance and get the accessKeyId and accessKeySecret.

Create A Bucket Instance

Each OSS instance required accessKeyId, accessKeySecret and bucket.

oss(options)

Create a Bucket store instance.

options:

example:

  1. basic usage
const OSS = require('ali-oss');

const store = new OSS({
  accessKeyId: 'your access key',
  accessKeySecret: 'your access secret',
  bucket: 'your bucket name',
  region: 'oss-cn-hangzhou'
});
  1. use accelerate endpoint
const OSS = require('ali-oss');

const store = new OSS({
  accessKeyId: 'your access key',
  accessKeySecret: 'your access secret',
  bucket: 'your bucket name',
  endpoint: 'oss-accelerate.aliyuncs.com'
});
  1. use custom domain
const OSS = require('ali-oss');

const store = new OSS({
  accessKeyId: 'your access key',
  accessKeySecret: 'your access secret',
  cname: true,
  endpoint: 'your custome domain'
});
  1. use STS and refreshSTSToken
const OSS = require('ali-oss');

const store = new OSS({
  accessKeyId: 'your STS key',
  accessKeySecret: 'your STS secret',
  stsToken: 'your STS token',
  refreshSTSToken: async () => {
    const info = await fetch('you sts server');
    return {
      accessKeyId: info.accessKeyId,
      accessKeySecret: info.accessKeySecret,
      stsToken: info.stsToken
    };
  },
  refreshSTSTokenInterval: 300000
});
  1. retry request with stream
for (let i = 0; i <= store.options.retryMax; i++) {
  try {
    const result = await store.putStream('<example-object>', fs.createReadStream('<example-path>'));
    console.log(result);
    break; // break if success
  } catch (e) {
    console.log(e);
  }
}
  1. use V4 signature, and use optional additionalHeaders option which type is a string array, and the values inside need to be included in the header.
const OSS = require('ali-oss');

const store = new OSS({
  accessKeyId: 'your access key',
  accessKeySecret: 'your access secret',
  bucket: 'your bucket name',
  region: 'oss-cn-hangzhou',
  authorizationV4: true
});

try {
  const bucketInfo = await store.getBucketInfo('your bucket name');
  console.log(bucketInfo);
} catch (e) {
  console.log(e);
}

try {
  const putObjectResult = await store.put('your bucket name', 'your object name', {
    headers: {
      // The headers of this request
      header1: 'value1',
      header2: 'value2'
    },
    // The keys of the request headers that need to be calculated into the V4 signature. Please ensure that these additional headers are included in the request headers.
    additionalHeaders: ['additional header1', 'additional header2']
  });
  console.log(putObjectResult);
} catch (e) {
  console.log(e);
}

Bucket Operations

.listBuckets(query[, options])

List buckets in this account.

parameters:

Success will return buckets list on buckets properties.

example:

store
  .listBuckets({
    'max-keys': 10
  })
  .then(result => {
    console.log(result);
  });

.putBucket(name[, options])

Create a new bucket.

parameters:

Success will return the bucket name on bucket properties.

example:

store.putBucket('helloworld').then(result => {
  // use it by default
  store.useBucket('helloworld');
});
await store.putBucket('helloworld', { StorageClass: 'Archive' });
// use it by default
store.useBucket('helloworld');

.deleteBucket(name[, options])

Delete an empty bucket.

parameters:

Success will return:

example:

store.deleteBucket('helloworld').then(result => {});

.useBucket(name)

Use the bucket.

parameters:

example:

store.useBucket('helloworld');

.getBucketInfo(name)

Get bucket information,include CreationDate、ExtranetEndpoint、IntranetEndpoint、Location、Name、StorageClass、 Owner、AccessControlList、Versioning

parameters:

example:

store.getBucketInfo('helloworld').then(res => {
  console.log(res.bucket);
});

.getBucketStat(name)

Call the GetBucketStat interface to get the storage capacity of the specified storage space (Bucket) and the number of files (Object).

Calling this interface requires the oss:GetBucketStat permission. The data obtained by calling this interface is not real-time data and may be delayed for more than an hour. The point in time of the stored information obtained by calling this interface is not guaranteed to be up-to-date, i.e. the LastModifiedTime field returned by a later call to this interface may be smaller than the LastModifiedTime field returned by a previous call to this interface.

parameters:

Success will return:

example:

store.getBucketStat().then(res => console.log(res));

.getBucketLocation(name)

Get bucket location

parameters:

example:

store.getBucketLocation('helloworld').then(res => {
  console.log(res.location);
});

.putBucketACL(name, acl[, options])

Update the bucket ACL.

parameters:

Success will return:

example:

store.putBucketACL('helloworld', 'public-read-write').then(result => {});

.getBucketACL(name[, options])

Get the bucket ACL.

parameters:

Success will return:

example:

store.getBucketACL('helloworld').then(result => {
  console.log(result.acl);
});

.putBucketLogging(name, prefix[, options])

Update the bucket logging settings. Log file will create every one hour and name format: <prefix><bucket>-YYYY-mm-DD-HH-MM-SS-UniqueString.

parameters:

Success will return:

example:

store.putBucketLogging('helloworld', 'logs/').then(result => {});

.getBucketLogging(name[, options])

Get the bucket logging settings.

parameters:

Success will return:

example:

store.getBucketLogging('helloworld').then(result => {
  console.log(result.enable, result.prefix);
});

.deleteBucketLogging(name[, options])

Delete the bucket logging settings.

parameters:

Success will return:


.putBucketWebsite(name, config[, options])

Set the bucket as a static website.

parameters:

Success will return:

example:

store
  .putBucketWebsite('hello', {
    index: 'index.html'
  })
  .then(result => {});

.getBucketWebsite(name[, options])

Get the bucket website config.

parameters:

Success will return:

.deleteBucketWebsite(name[, options])

Delete the bucket website config.

parameters:

Success will return:


.putBucketReferer(name, allowEmpty, referers[, options])

Set the bucket request Referer white list.

parameters:

Success will return:

example:

store.putBucketReferer('hello', false, ['https://npm.taobao.org', 'http://cnpmjs.org']).then(result => {});

.getBucketReferer(name[, options])

Get the bucket request Referer white list.

parameters:

Success will return:

.deleteBucketReferer(name[, options])

Delete the bucket request Referer white list.

parameters:

Success will return:


.putBucketLifecycle(name, rules[, options])

Set the bucket object lifecycle.

parameters:

Success will return:

example:

store
  .putBucketLifecycle('hello', [
    {
      id: 'delete after one day',
      prefix: 'logs/',
      status: 'Enabled',
      days: 1
    },
    {
      prefix: 'logs2/',
      status: 'Disabled',
      date: '2022-10-11T00:00:00.000Z'
    }
  ])
  .then(result => {});

example: for history with noncurrentVersionExpiration

const result = await store.putBucketLifecycle(bucket, [
  {
    id: 'expiration1',
    prefix: 'logs/',
    status: 'Enabled',
    expiration: {
      days: '1'
    },
    noncurrentVersionExpiration: {
      noncurrentDays: '1'
    }
  }
]);
console.log(result);

example: for history with expiredObjectDeleteMarker

const result = await store.putBucketLifecycle(bucket, [
  {
    id: 'expiration1',
    prefix: 'logs/',
    status: 'Enabled',
    expiration: {
      expiredObjectDeleteMarker: 'true'
    },
    noncurrentVersionExpiration: {
      noncurrentDays: '1'
    }
  }
]);
console.log(result);

example: for history with noncurrentVersionTransition

const result = await store.putBucketLifecycle(bucket, [
  {
    id: 'expiration1',
    prefix: 'logs/',
    status: 'Enabled',
    noncurrentVersionTransition: {
      noncurrentDays: '10',
      storageClass: 'IA'
    }
  }
]);
console.log(result);

.getBucketLifecycle(name[, options])

Get the bucket object lifecycle.

parameters:

Success will return:

.deleteBucketLifecycle(name[, options])

Delete the bucket object lifecycle.

parameters:

Success will return:


.putBucketCORS(name, rules[, options])

Set CORS rules of the bucket object

parameters:

Success will return:

example:

store
  .putBucketCORS('hello', [
    {
      allowedOrigin: '*',
      allowedMethod: ['GET', 'HEAD']
    }
  ])
  .then(result => {});

.getBucketCORS(name[, options])

Get CORS rules of the bucket object.

parameters:

Success will return:

.deleteBucketCORS(name[, options])

Delete CORS rules of the bucket object.

parameters:

Success will return:

.getBucketRequestPayment(bucketName[, options])

get RequestPayment value of the bucket object.

parameters:

Success will return:


.putBucketRequestPayment(bucketName, payer[, options])

put RequestPayment value of the bucket object.

parameters:

Success will return:


.putBucketEncryption(name, rules)

put BucketEncryption value of the bucket object.

parameters:

Success will return:


.getBucketEncryption(name)

get BucketEncryption rule value of the bucket object.

parameters:

Success will return:


.deleteBucketEncryption(name)

delete BucketEncryption rule value of the bucket object.

parameters:

Success will return:


.putBucketTags(name, tag[, options])

Adds tags for a bucket or modify the tags for a bucket.

parameters:

Success will return:


.getBucketTags(name[, options])

Obtains the tags for a bucket.

parameters:

Success will return:


.deleteBucketTags(name[, options])

Deletes the tags added for a bucket.

parameters:

Success will return:


.putBucketPolicy(name, policy[, options])

Adds or modify policy for a bucket.

parameters:

Success will return:

example:

const policy = {
  Version: '1',
  Statement: [
    {
      Action: ['oss:PutObject', 'oss:GetObject'],
      Effect: 'Deny',
      Principal: ['1234567890'],
      Resource: ['acs:oss:*:1234567890:*/*']
    }
  ]
};
const result = await store.putBucketPolicy(bucket, policy);
console.log(result);

.getBucketPolicy(name[, options])

Obtains the policy for a bucket.

parameters:

Success will return:


.deleteBucketPolicy(name[, options])

Deletes the policy added for a bucket.

parameters:

Success will return:


.getBucketVersioning(name[, options])

Obtains the version status of an object

parameters:

Success will return:


.putBucketVersioning(name, status[, options])

set the version status of an object

parameters:

Success will return:


.getBucketInventory(name, inventoryId[, options])

get bucket inventory by inventory-id

parameters:

Success will return:

async function getBucketInventoryById() {
  try {
    const result = await store.getBucketInventory('bucket', 'inventoryid');
    console.log(result.inventory);
  } catch (err) {
    console.log(err);
  }
}

getBucketInventoryById();

putBucketInventory(name, inventory[, options])

set bucket inventory

parameters:

Success will return:

type Field =
  'Size | LastModifiedDate | ETag | StorageClass | IsMultipartUploaded | EncryptionStatus | ObjectAcl | TaggingCount | ObjectType | Crc64';
interface Inventory {
  id: string;
  isEnabled: true | false;
  prefix?: string;
  OSSBucketDestination: {
    format: 'CSV';
    accountId: string;
    rolename: string;
    bucket: string;
    prefix?: string;
    encryption?:
      | { 'SSE-OSS': '' }
      | {
          'SSE-KMS': {
            keyId: string;
          };
        };
  };
  frequency: 'Daily' | 'Weekly';
  includedObjectVersions: 'Current' | 'All';
  optionalFields?: {
    field?: Field[];
  };
}
const inventory = {
  id: 'default',
  isEnabled: false, // `true` | `false`
  prefix: 'ttt', // filter prefix
  OSSBucketDestination: {
    format: 'CSV',
    accountId: '1817184078010220',
    rolename: 'AliyunOSSRole',
    bucket: 'your bucket',
    prefix: 'test'
    //encryption: {'SSE-OSS': ''},
    /*
      encryption: {
      'SSE-KMS': {
        keyId: 'test-kms-id';
      };,
    */
  },
  frequency: 'Daily', // `WEEKLY` | `Daily`
  includedObjectVersions: 'All', // `All` | `Current`
  optionalFields: {
    field: [
      'Size',
      'LastModifiedDate',
      'ETag',
      'StorageClass',
      'IsMultipartUploaded',
      'EncryptionStatus',
      'ObjectAcl',
      'TaggingCount',
      'ObjectType',
      'Crc64'
    ]
  }
};

async function putInventory() {
  const bucket = 'Your Bucket Name';
  try {
    await store.putBucketInventory(bucket, inventory);
  } catch (err) {
    console.log(err);
  }
}

putInventory();

deleteBucketInventory(name, inventoryId[, options])

delete bucket inventory by inventory-id

parameters:

Success will return:

listBucketInventory(name[, options])

list bucket inventory

parameters:

Success will return:

example:

async function listBucketInventory() {
  const bucket = 'Your Bucket Name';
  let nextContinuationToken;
  // list all inventory of the bucket
  do {
    const result = await store.listBucketInventory(bucket, nextContinuationToken);
    console.log(result.inventoryList);
    nextContinuationToken = result.nextContinuationToken;
  } while (nextContinuationToken);
}

listBucketInventory();

.abortBucketWorm(name[, options])

used to delete an unlocked retention policy.

parameters:

Success will return:


.completeBucketWorm(name, wormId[, options])

used to lock a retention policy.

parameters:

Success will return:


.extendBucketWorm(name, wormId, days[, options])

used to extend the retention period of objects in a bucket whose retention policy is locked.

parameters:

Success will return:


.getBucketWorm(name[, options])

used to query the retention policy information of the specified bucket.

parameters:

Success will return:


.initiateBucketWorm(name, days[, options])

create a retention policy.

parameters:

Success will return:


Object Operations

All operations function return Promise, except signatureUrl.

.put(name, file[, options])

Add an object to the bucket.

parameters:

Success will return the object information.

object:

example:

const filepath = '/home/ossdemo/demo.txt';
store.put('ossdemo/demo.txt', filepath).then((result) => {
  console.log(result);
});

// {
//   name: 'ossdemo/demo.txt',
//   res: {
//     status: 200,
//     headers: {
//       date: 'Tue, 17 Feb 2015 13:28:17 GMT',
//       'content-length': '0',
//       connection: 'close',
//       etag: '"BF7A03DA01440845BC5D487B369BC168"',
//       server: 'AliyunOSS',
//       'x-oss-request-id': '54E341F1707AA0275E829244'
//     },
//     size: 0,
//     rt: 92
//   }
// }
store.put('ossdemo/buffer', Buffer.from('foo content')).then((result) => {
  console.log(result);
});

// {
//   name: 'ossdemo/buffer',
//   url: 'http://demo.oss-cn-hangzhou.aliyuncs.com/ossdemo/buffer',
//   res: {
//     status: 200,
//     headers: {
//       date: 'Tue, 17 Feb 2015 13:28:17 GMT',
//       'content-length': '0',
//       connection: 'close',
//       etag: '"xxx"',
//       server: 'AliyunOSS',
//       'x-oss-request-id': '54E341F1707AA0275E829243'
//     },
//     size: 0,
//     rt: 92
//   }
// }
const filepath = '/home/ossdemo/demo.txt';
store.put('ossdemo/readstream.txt', fs.createReadStream(filepath)).then((result) => {
  console.log(result);
});

// {
//   name: 'ossdemo/readstream.txt',
//   url: 'http://demo.oss-cn-hangzhou.aliyuncs.com/ossdemo/readstream.txt',
//   res: {
//     status: 200,
//     headers: {
//       date: 'Tue, 17 Feb 2015 13:28:17 GMT',
//       'content-length': '0',
//       connection: 'close',
//       etag: '"BF7A03DA01440845BC5D487B369BC168"',
//       server: 'AliyunOSS',
//       'x-oss-request-id': '54E341F1707AA0275E829242'
//     },
//     size: 0,
//     rt: 92
//   }
// }

.putStream(name, stream[, options])

Add a stream object to the bucket.

parameters:

Success will return the object information.

object:

example:

const filepath = '/home/ossdemo/demo.txt';
store.putStream('ossdemo/readstream.txt', fs.createReadStream(filepath)).then((result) => {
  console.log(result);
});

// {
//   name: 'ossdemo/readstream.txt',
//   url: 'http://demo.oss-cn-hangzhou.aliyuncs.com/ossdemo/readstream.txt',
//   res: {
//     status: 200,
//     headers: {
//       date: 'Tue, 17 Feb 2015 13:28:17 GMT',
//       'content-length': '0',
//       connection: 'close',
//       etag: '"BF7A03DA01440845BC5D487B369BC168"',
//       server: 'AliyunOSS',
//       'x-oss-request-id': '54E341F1707AA0275E829242'
//     },
//     size: 0,
//     rt: 92
//   }
// }

.append(name, file[, options])

Append an object to the bucket, it's almost same as put, but it can add content to existing object rather than override it.

All parameters are same as put except for options.position

object:

example:

let object = await store.append('ossdemo/buffer', Buffer.from('foo'));

// append content to the existing object
object = await store.append('ossdemo/buffer', Buffer.from('bar'), {
  position: object.nextAppendPosition
});

.getObjectUrl(name[, baseUrl])

Get the Object url. If provide baseUrl, will use baseUrl instead the default endpoint.

e.g.:

const cdnUrl = store.getObjectUrl('foo/bar.jpg', 'https://mycdn.domian.com');
// cdnUrl should be `https://mycdn.domian.com/foo/bar.jpg`

.generateObjectUrl(name[, baseUrl])

Get the Object url. If provide baseUrl, will use baseUrl instead the default bucket and endpoint. Suggest use generateObjectUrl instead of getObjectUrl.

e.g.:

const url = store.generateObjectUrl('foo/bar.jpg');
// cdnUrl should be `https://${bucketname}.${endpotint}foo/bar.jpg`

const cdnUrl = store.generateObjectUrl('foo/bar.jpg', 'https://mycdn.domian.com');
// cdnUrl should be `https://mycdn.domian.com/foo/bar.jpg`

.head(name[, options])

Head an object and get the meta info.

parameters:

Success will return the object's meta information.

object:

example:

await this.store.put('ossdemo/head-meta', Buffer.from('foo'), {
  meta: {
    uid: 1,
    path: 'foo/demo.txt'
  }
});
const object = await this.store.head('ossdemo/head-meta');
console.log(object);

// {
//   status: 200,
//   meta: {
//     uid: '1',
//     path: 'foo/demo.txt'
//   },
//   res: { ... }
// }
const object = await this.store.head('ossdemo/head-meta');
// will throw NoSuchKeyError

.getObjectMeta(name[, options])

Get an object meta info include ETag、Size、LastModified and so on, not return object content.

parameters:

Success will return the object's meta information.

object:

example:

await this.store.put('ossdemo/object-meta', Buffer.from('foo'));
const object = await this.store.getObjectMeta('ossdemo/object-meta');
console.log(object);

// {
//   status: 200,
//   res: { ... }
// }

.get(name[, file, options])

Get an object from the bucket.

parameters:

Success will return the info contains response.

object:

If object not exists, will throw NoSuchKeyError.

example:

const filepath = '/home/ossdemo/demo.txt';
await store.get('ossdemo/demo.txt', filepath);

_ Store object to a writestream

await store.get('ossdemo/demo.txt', somestream);
const result = await store.get('ossdemo/demo.txt');
console.log(Buffer.isBuffer(result.content));
const filepath = '/home/ossdemo/demo.png';
await store.get('ossdemo/demo.png', filepath, { process: 'image/resize,w_200' });
const filepath = '/home/ossdemo/demo.txt';
await store.get('ossdemo/not-exists-demo.txt', filepath);
// will throw NoSuchKeyError
const filepath = '/home/ossdemo/demo.txt';
const versionId = 'versionId string';
await store.get('ossdemo/not-exists-demo.txt', filepath, {
  versionId
});
const versionId = 'versionId string';
await store.get('ossdemo/not-exists-demo.txt', { versionId });

.getStream(name[, options])

Get an object read stream.

parameters:

Success will return the stream instance and response info.

object:

If object not exists, will throw NoSuchKeyError.

example:

const result = await store.getStream('ossdemo/demo.txt');
result.stream.pipe(fs.createWriteStream('some file.txt'));

.delete(name[, options])

Delete an object from the bucket.

parameters:

Success will return the info contains response.

object:

If delete object not exists, will also delete success.

example:

await store.delete('ossdemo/someobject');
await store.delete('ossdemo/some-not-exists-object');
const versionId = 'versionId';
await store.delete('ossdemo/some-not-exists-object', { versionId });

.copy(name, sourceName[, sourceBucket, options])

Copy an object from sourceName to name.

parameters:

Success will return the copy result in data property.

object:

If source object not exists, will throw NoSuchKeyError.

example:

store.copy('newName', 'oldName').then(result => {
  console.log(result);
});
store.copy('logo.png', 'logo.png', 'other-bucket').then(result => {
  console.log(result);
});
const versionId = 'your verisonId';
store.copy('logo.png', 'logo.png', 'other-bucket', { versionId }).then(result => {
  console.log(result);
});

.putMeta(name, meta[, options])

Set an exists object meta.

parameters:

Success will return the putMeta result in data property.

If object not exists, will throw NoSuchKeyError.

example:

const result = await store.putMeta('ossdemo.txt', {
  uid: 1,
  pid: 'p123'
});
console.log(result);
await store.putMeta('ossdemo.txt', null);

.deleteMulti(names[, options])

Delete multi objects in one request.

parameters: