oss-js-sdk
=======
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![coverage][cov-image]][cov-url]
[![David deps][david-image]][david-url]
[npm-image]: https://img.shields.io/npm/v/ali-oss.svg?style=flat-square
[npm-url]: https://npmjs.org/package/ali-oss
[travis-image]: https://img.shields.io/travis/ali-sdk/ali-oss/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/ali-sdk/ali-oss.svg?branch=master
[cov-image]: http://codecov.io/github/ali-sdk/ali-oss/coverage.svg?branch=master
[cov-url]: http://codecov.io/github/ali-sdk/ali-oss?branch=master
[david-image]: https://img.shields.io/david/ali-sdk/ali-oss.svg?style=flat-square
[david-url]: https://david-dm.org/ali-sdk/ali-oss
aliyun OSS(Object Storage Service) js client for Node and Browser env.
`NOTE`: For SDK `5.X` document, please go to [README.md](https://github.com/ali-sdk/ali-oss/blob/5.x/README.md)
## Install
```bash
npm install ali-oss --save
```
## Compatibility
### Node
Node.js >= 8.0.0 required. You can use 4.x in Node.js < 8.
### Browser
- IE >= 10 & Edge
- Major versions of Chrome/Firefox/Safari
- Major versions of Android/iOS/WP
`Note`:
- For Lower browsers you can refer to [PostObject](https://help.aliyun.com/document_detail/31988.html), if you want to see more practices ,please refer to [Web Post](https://help.aliyun.com/document_detail/31923.html)
## License
[MIT](LICENSE)
# OSS Usage
OSS, Object Storage Service. Equal to well known Amazon [S3](http://aws.amazon.com/s3/).
All operation use es7 async/await to implement. All api is async function.
## Summary
- [Node Usage](#node-usage)
- [Browser Usage](#browser-usage)
- [Data Regions](#data-regions)
- [Create Account](#create-acount)
- [Create A Bucket Instance](#create-a-bucket-instance)
- [oss(options)](#ossoptions)
- [Bucket Operations](#bucket-operations)
- Base
- [.listBuckets(query[, options])](#listbucketsquery-options)
- [.putBucket(name[, options])](#putbucketname-options)
- [.useBucket(name)](#usebucketname)
- [.deleteBucket(name[, options])](#deletebucketname-options)
- [.getBucketInfo(name)](#getbucketinfoname)
- [.getBucketLocation(name)](#getbucketlocationname)
- ACL
- [.putBucketACL(name, acl[, options])](#putbucketaclname-acl-options)
- [.getBucketACL(name[, options])](#getbucketaclname-options)
- Logging
- [.putBucketLogging(name, prefix[, options])](#putbucketloggingname-prefix-options)
- [.getBucketLogging(name[, options])](#getbucketloggingname-options)
- [.deleteBucketLogging(name[, options])](#deletebucketloggingname-options)
- Website
- [.putBucketWebsite(name, config[, options])](#putbucketwebsitename-config-options)
- [.getBucketWebsite(name[, options])](#getbucketwebsitename-options)
- [.deleteBucketWebsite(name, region[, options])](#deletebucketwebsitename-options)
- Referer
- [.putBucketReferer(name, allowEmpty, referers[, options])](#putbucketreferername-allowempty-referers-options)
- [.getBucketReferer(name[, options])](#getbucketreferername-options)
- [.deleteBucketReferer(name[, options])](#deletebucketreferername-options)
- Lifecycle
- [.putBucketLifecycle(name, rules[, options])](#putbucketlifecyclename-rules-options)
- [.getBucketLifecycle(name[, options])](#getbucketlifecyclename-options)
- [.deleteBucketLifecycle(name[, options])](#deletebucketlifecyclename-options)
- CORS
- [.putBucketCORS(name, rules[, options])](#putbucketcorsname-rules-options)
- [.getBucketCORS(name[, options])](#getbucketcorsname-options)
- [.deleteBucketCORS(name[, options])](#deletebucketcorsname-options)
- RequestPayment
- [.getBucketRequestPayment(bucketName[, options])](#getbucketrequestpaymentbucketname-options)
- [.putBucketRequestPayment(bucketName, payer[, options])](#putBucketRequestpaymentbucketname-payer-options)
- BucketEncryption
- [.putBucketEncryption(name[, options])](#putbucketencryptionbucketname-options)
- [.getBucketEncryption(name)](#getbucketencryptionbucketname-options)
- [.deleteBucketEncryption(name)](#deletebucketencryptionbucketname-options)
- tagging
- [.putBucketTags(name, tag[, options])](#putBucketTagsname-tag-options)
- [.getBucketTags(name, [, options])](#getBucketTagsname-options)
- [.deleteBucketTags(name, [, options])](#deleteBucketTagsname-options)
- policy
- [.putBucketPolicy(name, policy[, options])](#putBucketPolicyname-policy-options)
- [.getBucketPolicy(name, [, options])](#getBucketPolicyname-options)
- [.deleteBucketPolicy(name, [, options])](#deleteBucketPolicyname-options)
- [Object Operations](#object-operations)
- [.list(query[, options])](#listquery-options)
- [.put(name, file[, options])](#putname-file-options)
- [.putStream(name, stream[, options])](#putstreamname-stream-options)
- [.append(name, file[, options])](#appendname-file-options)
- [.getObjectUrl(name[, baseUrl])](#getobjecturlname-baseurl)
- [.generateObjectUrl(name[, baseUrl])](#generateobjecturlname-baseurl)
- [.head(name[, options])](#headname-options)
- [.getObjectMeta(name)](#getobjectmetaname)
- [.get(name[, file, options])](#getname-file-options)
- [.getStream(name[, options])](#getstreamname-options)
- [.delete(name[, options])](#deletename-options)
- [.copy(name, sourceName[, sourceBucket, options])](#copyname-sourcename-sourcebucket-options)
- [.putMeta(name, meta[, options])](#putmetaname-meta-options)
- [.deleteMulti(names[, options])](#deletemultinames-options)
- [.signatureUrl(name[, options])](#signatureurlname-options)
- [.putACL(name, acl[, options])](#putaclname-acl-options)
- [.getACL(name[, options])](#getaclname-options)
- [.restore(name[, options])](#restorename-options)
- [.putSymlink(name, targetName[, options])](#putsymlinkname-targetname-options)
- [.getSymlink(name[, options])](#getsymlinkname-options)
- [.initMultipartUpload(name[, options])](#initmultipartuploadname-options)
- [.uploadPart(name, uploadId, partNo, file, start, end[, options])](#uploadpartname-uploadid-partno-file-start-end-options)
- [.uploadPartCopy(name, uploadId, partNo, range, sourceData[, options])](#uploadpartcopyname-uploadid-partno-range-sourcedata-options)
- [.completeMultipartUpload(name, uploadId, parts[, options])](#completemultipartuploadname-uploadid-parts-options)
- [.multipartUpload(name, file[, options])](#multipartuploadname-file-options)
- [.multipartUploadCopy(name, sourceData[, options])](#multipartuploadcopyname-sourcedata-options)
- [.listParts(name, uploadId[, query, options])](#listparts-name-uploadid-query-options)
- [.listUploads(query[, options])](#listuploadsquery-options)
- [.abortMultipartUpload(name, uploadId[, options])](#abortmultipartuploadname-uploadid-options)
- [.calculatePostSignature(policy)](#calculatePostSignaturepolicy)
- [.getObjectTagging(name, [, options])](#getObjectTaggingname-options)
- [.putObjectTagging(name, tag[, options])](#putObjectTaggingname-tag-options)
- [.deleteObjectTagging(name, [, options])](#deleteObjectTaggingname-options)
- [RTMP Operations](#rtmp-operations)
- [.putChannel(id, conf[, options])](#putchannelid-conf-options)
- [.getChannel(id[, options])](#getchannelid-options)
- [.deleteChannel(id[, options])](#deletechannelid-options)
- [.putChannelStatus(id, status[, options])](#putchannelstatusid-status-options)
- [.getChannelStatus(id[, options])](#getchannelstatusid-options)
- [.listChannels(query[, options])](#listchannelsquery-options)
- [.getChannelHistory(id[, options])](#getchannelhistoryid-options)
- [.createVod(id, name, time[, options])](#createvodid-name-time-options)
- [.getRtmpUrl(channelId[, options])](#getrtmpurlchannelid-options)
- [Create A Image Service Instance](#create-a-image-service-instance)
- [oss.ImageClient(options)](#ossimageclientoptions)
- [Image Operations](#image-operations)
- [imgClient.get(name, file[, options])