This topic describes the parameters that you can configure when you use the OSS SDK for Node.js.

The parameters that you can configure are described as follows:

  • [accessKeyId] {String}: The AccessKey ID that you created on the Alibaba Cloud Management console.
  • [accessKeySecret] {String}: The AccessKey secret that you created on the Alibaba Cloud Management console.
  • [stsToken] {String}: The temporary STS token used to access OSS. For more information, see Use STS to authorize temporary access.
  • [bucket] {String}: The bucket that you create on the console or by calling PutBucket.
  • [endpoint] {String}: The endpoint used to access your OSS bucket.
  • [region] {String}: The region where your bucket is located. Default value: oss-cn-hangzhou.
  • [internal] {Boolean}: Indicates whether to use the Alibaba Cloud internal network to access OSS. Default value: false. Example: Set this parameter to true if you use an ECS instance to access OSS. The ECS instance accesses OSS through the Alibaba Cloud internal network, which saves costs.
  • [cname] {Boolean}: Indicates whether CNAME can be used to access OSS. Default value: false. If you set this parameter to true, you must bind a CNAME to your bucket before you use the CNAME to access the bucket.
  • [isRequestPay] {Boolean}: Indicates whether pay-by-requester mode is enabled for your bucket. Default value: false.
  • [secure] {Boolean}: Indicates whether HTTPS is used to access OSS. The value of true indicates that HTTPS is used to access OSS. The value of false indicates that HTTP is used to access OSS. For more information, see FAQ.
  • [timeout] {String|Number}: The timeout period in second. Default value: 60.

The following code provides an example on how to configure parameters when you use the OSS SDK for Node.js:

var oss = require('ali-oss');

var store = oss({
  accessKeyId: 'your access key',
  accessKeySecret: 'your access secret',
  bucket: 'your bucket name',
  region: 'oss-cn-hangzhou'
});