Skip to content

Commit

Permalink
modify sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu authored and carsonxu committed May 31, 2017
1 parent f66cc2e commit f5a70f3
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 142 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea
node_modules
/demo/*.zip
/demo/*.zip
16 changes: 8 additions & 8 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var cos = new COS({
});

function getService() {
cos.getService({}, function (err, data) {
cos.getService(function (err, data) {
return console.log(err || data);
});
}
Expand Down Expand Up @@ -95,7 +95,7 @@ function headBucket() {

function putBucket() {
cos.putBucket({
Bucket: 'test-new',
Bucket: 'testnew',
Region: config.Region
}, function (err, data) {
if (err) {
Expand All @@ -107,7 +107,7 @@ function putBucket() {

function deleteBucket() {
cos.deleteBucket({
Bucket: 'test-new',
Bucket: 'testnew',
Region: config.Region
}, function (err, data) {
if (err) {
Expand Down Expand Up @@ -135,9 +135,9 @@ function putBucketACL() {
cos.putBucketACL({
Bucket: config.Bucket,
Region: config.Region,
//GrantWrite : 'uin="1111", uin="2222"',
ACL: 'public-read',
// ACL: 'private'
// GrantWrite : 'uin="1111", uin="2222"',
// ACL: 'public-read',
ACL: 'private'
}, function (err, data) {
if (err) {
return console.log(err);
Expand Down Expand Up @@ -166,7 +166,7 @@ function putBucketCORS() {
Region: config.Region,
CORSRules: [{
"AllowedOrigin": ["*"],
"AllowedMethod": ["PUT", "GET", "POST", "DELETE", "HEAD"],
"AllowedMethod": ["GET", "POST", "PUT", "DELETE", "HEAD"],
"AllowedHeader": ["origin", "accept", "content-type", "authorzation"],
"ExposeHeader": ["ETag"],
"MaxAgeSeconds": "300"
Expand All @@ -175,7 +175,6 @@ function putBucketCORS() {
if (err) {
return console.log(err);
}

console.log(JSON.stringify(data, null, ' '));
});
}
Expand All @@ -188,6 +187,7 @@ function getBucketLocation() {
if (err) {
return console.log(err);
}
console.log(JSON.stringify(data, null, ' '));
});
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cos-nodejs-sdk-v5",
"version": "1.1.2",
"version": "1.1.3",
"description": "cos nodejs sdk v5",
"main": "index.js",
"devDependencies": {},
Expand Down
12 changes: 6 additions & 6 deletions sdk/advance.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function getAllListParts(params, callback) {
params.UploadList = UploadList;
var self = this;

self.MultipartList(params, function (err, data) {
self.multipartList(params, function (err, data) {
if (err) {
return callback(err);
}
Expand Down Expand Up @@ -251,7 +251,7 @@ function getUploadId(params, callback) {
});
} else {
// 不存在 UploadId, 直接初始化生成 UploadId
self.MultipartInit({
self.multipartInit({
Bucket: Bucket,
Region: Region,
Key: Key,
Expand Down Expand Up @@ -311,7 +311,7 @@ function getUploadedParts(params, callback) {

params.Parts = Parts;

self.MultipartListPart({
self.multipartListPart({
Bucket: Bucket,
Region: Region,
Key: Key,
Expand Down Expand Up @@ -598,7 +598,7 @@ function uploadSliceItem(params, callback) {

var ContentSha1 = SliceList[PartNumber * 1 - 1].ETag;

self.MultipartUpload({
self.multipartUpload({
Bucket: Bucket,
Region: Region,
Key: Key,
Expand Down Expand Up @@ -638,7 +638,7 @@ function uploadSliceComplete(params, callback) {
Parts.push(PartItem);
}

self.MultipartComplete({
self.multipartComplete({
Bucket: Bucket,
Region: Region,
Key: Key,
Expand Down Expand Up @@ -761,7 +761,7 @@ function abortUploadTaskArray(params, callback) {

var UploadId = AbortItem.UploadID;

self.MultipartAbort({
self.multipartAbort({
Bucket: Bucket,
Region: Region,
Key: AbortItem.Key,
Expand Down
Loading

0 comments on commit f5a70f3

Please sign in to comment.