cos-nodejs-sdk-v5
Advanced tools
Comparing version 2.2.3 to 2.2.4
@@ -28,3 +28,4 @@ var fs = require('fs'); | ||
Method: 'get', | ||
Key: key | ||
Key: key, | ||
Expires: 60, | ||
}); | ||
@@ -50,3 +51,3 @@ // 注意:这里的 Bucket 格式是 test-1250000000 | ||
cos.putBucket({ | ||
Bucket: 'testnew-' + config.Bucket.substr(config.Bucket.indexOf('-') + 1), | ||
Bucket: 'testnew-' + config.Bucket.substr(config.Bucket.lastIndexOf('-') + 1), | ||
Region: 'ap-guangzhou' | ||
@@ -199,3 +200,3 @@ }, function (err, data) { | ||
function putBucketPolicy() { | ||
var AppId = config.Bucket.substr(config.Bucket.indexOf('-') + 1); | ||
var AppId = config.Bucket.substr(config.Bucket.lastIndexOf('-') + 1); | ||
cos.putBucketPolicy({ | ||
@@ -313,3 +314,3 @@ Policy: { | ||
function putBucketReplication() { | ||
var AppId = config.Bucket.substr(config.Bucket.indexOf('-') + 1); | ||
var AppId = config.Bucket.substr(config.Bucket.lastIndexOf('-') + 1); | ||
cos.putBucketReplication({ | ||
@@ -323,5 +324,5 @@ Bucket: config.Bucket, // Bucket 格式:test-1250000000 | ||
Status: "Enabled", | ||
Prefix: 'img/', | ||
Prefix: "img/", | ||
Destination: { | ||
Bucket: "qcs::cos:ap-tianjin::shanghai-" + AppId, | ||
Bucket: "qcs::cos:ap-guangzhou::test-" + AppId | ||
}, | ||
@@ -345,3 +346,3 @@ }] | ||
function deleteBucketReplication() { | ||
cos.getBucketReplication({ | ||
cos.deleteBucketReplication({ | ||
Bucket: config.Bucket, // Bucket 格式:test-1250000000 | ||
@@ -356,3 +357,3 @@ Region: config.Region | ||
cos.deleteBucket({ | ||
Bucket: 'testnew-' + config.Bucket.substr(config.Bucket.indexOf('-') + 1), | ||
Bucket: 'testnew-' + config.Bucket.substr(config.Bucket.lastIndexOf('-') + 1), | ||
Region: 'ap-guangzhou' | ||
@@ -453,3 +454,3 @@ }, function (err, data) { | ||
// "Owner": { // AccessControlPolicy 里必须有 owner | ||
// "ID": 'qcs::cam::uin/10001:uin/10001' // 10001 是 Bucket 所属用户的 QQ 号 | ||
// "ID": 'qcs::cam::uin/459000000:uin/459000000' // 459000000 是 Bucket 所属用户的 QQ 号 | ||
// }, | ||
@@ -456,0 +457,0 @@ // "Grants": [{ |
{ | ||
"name": "cos-nodejs-sdk-v5", | ||
"version": "2.2.3", | ||
"version": "2.2.4", | ||
"description": "cos nodejs sdk v5", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,3 +14,2 @@ var fs = require('fs'); | ||
var FilePath = params.FilePath; | ||
var AppId = params.AppId; | ||
var SliceSize = params.SliceSize || this.options.ChunkSize; | ||
@@ -42,3 +41,2 @@ var AsyncLimit = params.AsyncLimit; | ||
Key: Key, | ||
AppId: AppId, | ||
UploadId: data.UploadId, | ||
@@ -62,3 +60,2 @@ SliceList: data.SliceList | ||
Key: Key, | ||
AppId: AppId, | ||
FilePath: FilePath, | ||
@@ -88,3 +85,2 @@ FileSize: FileSize, | ||
Key: Key, | ||
AppId: AppId, | ||
StorageClass: StorageClass, | ||
@@ -124,3 +120,2 @@ FilePath: FilePath, | ||
var Key = params.Key; | ||
var AppId = params.AppId; | ||
var StorageClass = params.StorageClass; | ||
@@ -242,3 +237,2 @@ var self = this; | ||
Key: Key, | ||
AppId: AppId, | ||
StorageClass: StorageClass, | ||
@@ -267,3 +261,2 @@ }); | ||
Key: Key, | ||
AppId: AppId, | ||
UploadId: UploadId, | ||
@@ -308,3 +301,2 @@ }, function (err, PartListData) { | ||
Key: Key, | ||
AppId: AppId | ||
}, function (err, data) { | ||
@@ -335,3 +327,2 @@ if (!self._isRunningTask(TaskId)) return; | ||
Region: params.Region, | ||
AppId: params.AppId, | ||
Prefix: params.Key | ||
@@ -363,3 +354,2 @@ }; | ||
Key: params.Key, | ||
AppId: params.AppId, | ||
UploadId: params.UploadId | ||
@@ -398,3 +388,2 @@ }; | ||
var Key = params.Key; | ||
var AppId = params.AppId; | ||
var UploadData = params.UploadData; | ||
@@ -426,3 +415,2 @@ var FileSize = params.FileSize; | ||
Key: Key, | ||
AppId: AppId, | ||
SliceSize: SliceSize, | ||
@@ -468,3 +456,2 @@ FileSize: FileSize, | ||
var Key = params.Key; | ||
var AppId = params.AppId; | ||
var FileSize = params.FileSize; | ||
@@ -499,3 +486,2 @@ var FilePath = params.FilePath; | ||
Key: Key, | ||
AppId: AppId, | ||
ContentLength: ContentLength, | ||
@@ -528,3 +514,2 @@ ContentSha1: ContentSha1, | ||
var Key = params.Key; | ||
var AppId = params.AppId; | ||
var UploadId = params.UploadId; | ||
@@ -544,3 +529,2 @@ var SliceList = params.SliceList; | ||
Key: Key, | ||
AppId: AppId, | ||
UploadId: UploadId, | ||
@@ -567,3 +551,2 @@ Parts: Parts | ||
var Key = params.Key; | ||
var AppId = params.AppId; | ||
var UploadId = params.UploadId; | ||
@@ -586,3 +569,2 @@ var Level = params.Level || 'task'; | ||
Key: Key, | ||
AppId: AppId, | ||
AsyncLimit: AsyncLimit, | ||
@@ -589,0 +571,0 @@ AbortArray: AbortArray |
@@ -27,3 +27,3 @@ 'use strict'; | ||
if (options.AppId) { | ||
console.warn('AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").'); | ||
console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").'); | ||
} | ||
@@ -30,0 +30,0 @@ this.options = util.extend(util.clone(defaultOptions), options || {}); |
@@ -9,3 +9,3 @@ var initEvent = function (cos) { | ||
if (action === 'task-list-update') { | ||
console.warn('Event "' + action + '" has been deprecated. Please use "list-update" instead.'); | ||
console.warn('warning: Event "' + action + '" has been deprecated. Please use "list-update" instead.'); | ||
} | ||
@@ -12,0 +12,0 @@ getList(action).push(callback); |
@@ -81,2 +81,3 @@ var fs = require('fs'); | ||
var task = tasks[id]; | ||
if (!task) return; | ||
var waiting = task && task.state === 'waiting'; | ||
@@ -83,0 +84,0 @@ var running = task && (task.state === 'checking' || task.state === 'uploading'); |
@@ -237,3 +237,3 @@ 'use strict'; | ||
callback = callback || function () { | ||
}; | ||
}; | ||
if (apiName !== 'getService' && apiName !== 'abortUploadTask') { | ||
@@ -256,16 +256,17 @@ // 判断参数是否完整 | ||
// 兼容不带 AppId 的 Bucket | ||
var appId, m, bucket = params.Bucket; | ||
if (bucket) { | ||
if (m = bucket.match(/^(.+)-(\d+)$/)) { | ||
appId = m[2]; | ||
bucket = m[1]; | ||
params.AppId = appId; | ||
params.Bucket = bucket; | ||
} else if (!params.AppId) { | ||
if (this.options.AppId) { | ||
params.AppId = this.options.AppId; | ||
if (params.Bucket) { | ||
if (!/^(.+)-(\d+)$/.test(params.Bucket)) { | ||
if (params.AppId) { | ||
params.Bucket = params.Bucket + '-' + params.AppId; | ||
} else if (this.options.AppId) { | ||
params.Bucket = params.Bucket + '-' + this.options.AppId; | ||
} else { | ||
callback({error: 'Bucket should format as "test-1250000000".'}); | ||
return; | ||
} | ||
} | ||
if (params.AppId) { | ||
console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'); | ||
delete params.AppId; | ||
} | ||
} | ||
@@ -352,3 +353,3 @@ // 兼容带有斜杠开头的 Key | ||
throttleOnProgress: throttleOnProgress, | ||
isBrowser: !!global.document | ||
isBrowser: !!global.document, | ||
}; | ||
@@ -355,0 +356,0 @@ |
@@ -97,3 +97,3 @@ var fs = require('fs'); | ||
data.Buckets && data.Buckets.forEach(function (item) { | ||
if (item.Name === config.Bucket && item.Location === config.Region) { | ||
if (item.Name === BucketLongName && item.Location === config.Region) { | ||
hasBucket = true; | ||
@@ -178,2 +178,4 @@ } | ||
}).catch(function () { | ||
assert.equal(false); | ||
done(); | ||
}); | ||
@@ -180,0 +182,0 @@ }); |
Sorry, the diff of this file is too big to display
210475
5200