forked from ali-sdk/ali-oss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: add eslint for es6 * feat: add rule eslint * feat: code review check * refactor: node async await finish without cluster.js * refactor: browser async await format by eslint * feat: bucket lifecycle cors and so on need sync time more than 500ms * feat: browser structure with es7 * feat: browser structure with es7 * refactor: browser object async await and test case * feat: remove unused file * feat: rename file name and ignore config * add browser multipart upload parallel * fix: 1.upload part doneParts copy 2.if cancel multipart reset multipart upload options * refactor: add eslint for es6 * feat: add rule eslint * refactor: node async await finish without cluster.js * refactor: browser async await format by eslint * feat: browser structure with es7 * feat: code review check * chore: resolve confict * feat: remove unused file * feat: rename file name and ignore config * add browser multipart upload parallel * fix: 1.upload part doneParts copy 2.if cancel multipart reset multipart upload options * feat: add readme for async await operation * fix: multipart upload job cancel or err * fix: multipart upload job cancel or err * rm file * chore: resolve confict * test: ci * test: ci * test: ci * chore:delete package-lock.json * chore: modify browser test case * refactor:remove the region parameter of bucket operations * chore: mount debug to oss proto * refactor: add eslint for es6 * feat: add rule eslint * refactor: node async await finish without cluster.js * refactor: browser async await format by eslint * feat: bucket lifecycle cors and so on need sync time more than 500ms * feat: code review check * refactor: add eslint for es6 * feat: add rule eslint * refactor: node async await finish without cluster.js * refactor: browser async await format by eslint * feat: browser structure with es7 * feat: browser structure with es7 * feat: browser structure with es7 * feat: code review check * chore: resolve confict * refactor: browser object async await and test case * feat: remove unused file * feat: remove unused file * feat: rename file name and ignore config * feat: rename file name and ignore config * add browser multipart upload parallel * add browser multipart upload parallel * fix: 1.upload part doneParts copy 2.if cancel multipart reset multipart upload options * fix: 1.upload part doneParts copy 2.if cancel multipart reset multipart upload options * feat: add readme for async await operation * fix: multipart upload job cancel or err * fix: multipart upload job cancel or err * rm file * chore: resolve confict * test: ci * test: ci * test: ci * chore:delete package-lock.json * chore: modify browser test case * refactor:remove the region parameter of bucket operations * chore: mount debug to oss proto * docs: add UPGRADING.md * refactor: remove temp variable and update publish shell * docs: update UPGRADING.md * refactor: cluster async/await * chore: remove unuse browser.js * chore: set log level for debug * chore(release): 6.0.0
- Loading branch information
1 parent
63df586
commit 0f3b21b
Showing
52 changed files
with
3,513 additions
and
11,789 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ test/browser/.tmp | |
test/browser/build | ||
test/benchmark/ | ||
test/fixtures/ | ||
task/ | ||
task/ | ||
browser-build.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# @!title Upgrading Notes (5.x to 6.x) | ||
|
||
# Upgrading Notes (5.x to 6.x) | ||
|
||
No matter how it changes, our api name will never change. In order to give developers a better experience, we just change the way that the client use.the This document captures breaking changes from 5.x versions to the first | ||
stable 6.x (non-RC) release of the Aliyun SDK for JavaScript. | ||
|
||
## 1. Remove Region Param fo All Bucket Operations | ||
|
||
For all the bucket operation ,including putBucket、deleteBucket、getBucketInfo、 getBucketLoaction、 | ||
putBucketACL、gitBucketACL、 putBucketLogging、 getBucketLogging、 deleteBucketLogging、 putBucketWebsite、 | ||
getBucketWebsite、deleteBucketWebsite putBucketReferer getBucketReferer etc. | ||
|
||
Upgrading example | ||
|
||
The following 1.x code, eg deleteBucket | ||
|
||
``` | ||
const OSS = require('ali-oss'); | ||
const Client = new OSS(...); | ||
Client.deleteBucket(bucket,region); | ||
``` | ||
Should be changed to the following: | ||
|
||
``` | ||
const OSS = require('ali-oss'); | ||
const Client = new OSS(...); | ||
Client.deleteBucket(bucket); | ||
``` | ||
|
||
## 2. `Async Await` instead of `generator` Operation In Internal Code | ||
|
||
We use `Async Await` to refactor all api 、test case etc to instead of `co generator`。 | ||
it can optimize our code to maintain and provide with a better development experience for developers | ||
|
||
## 3. Dropped `OSS.Wrapper` When Init Client | ||
|
||
Before in async opearion we use `OSS.Wrapper` ,but now we just use `new OSS()` ,it will return Promise like `OSS.Wrapper`,please remmove `Wrapper`. | ||
|
||
Upgrading example | ||
|
||
The following 5.x code: | ||
|
||
``` | ||
const OSS = require('ali-oss'); | ||
const client = new OSS.Wrapper({ | ||
accessKeyId: xxx, | ||
accessKeySecret: xxx, | ||
region: xxx | ||
bucket: bucketName | ||
}) | ||
client.operation(...).then(...).catch(...); | ||
``` | ||
|
||
Should be changed to the following: | ||
|
||
``` | ||
const OSS = require('ali-oss'); | ||
const client = new OSS({ | ||
accessKeyId: xxx, | ||
accessKeySecret: xxx, | ||
region: xxx | ||
bucket: bucketName | ||
}) | ||
client.operation(...).then(...).catch(...); | ||
``` | ||
|
||
## 4.Support Cancel Operion For Node SDK When Upload File | ||
|
||
Should be used like: | ||
|
||
``` | ||
cosnt OSS = require('ali-oss'); | ||
const client = new OSS({ | ||
accessKeyId: xxx, | ||
accessKeySecret: xxx, | ||
region: 'xxx', | ||
bucket: bucketName | ||
}); | ||
// use bucket | ||
client.useBucket(bucketName); | ||
// progress | ||
const progress = async function progress(p, checkpoint) { | ||
console.log(p); | ||
}; | ||
const filePath = './resource/X.zip'; | ||
const options = { | ||
progress, | ||
partSize: 100 * 1024, | ||
meta: { | ||
year: 2017, | ||
people: 'test', | ||
}, | ||
}; | ||
//upload local file | ||
async function upload() { | ||
try { | ||
const result = await client.multipartUpload('bilibili/hahhh', filePath, options); | ||
} catch (e) { | ||
if (client.isCancel()) { | ||
console.log('canceled!'); | ||
// do | ||
} else { | ||
// do | ||
} | ||
} | ||
} | ||
upload(); | ||
// after 3s cancel | ||
setTimeout(() => { | ||
client.cancel(); | ||
}, 3000); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,5 @@ | |
"package.json" | ||
], | ||
"main": "dist/aliyun-oss-sdk.js", | ||
"version": "5.3.1" | ||
"version": "6.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.