Comparing version 0.4.2 to 0.5.0
@@ -61,9 +61,2 @@ #!/usr/bin/env node | ||
} | ||
}, | ||
acl: function(aclStr) { | ||
if(aclStr == 'public-read' || aclStr == 'private') { | ||
return aclStr; | ||
}else { | ||
throw new Error(' ACL不合法,有效值: private|public-read') | ||
} | ||
} | ||
@@ -95,3 +88,3 @@ } | ||
*/ | ||
program.command('upload').description('上传文件或者文件夹').option("-p --path [path]", "选择要上传的文件的地址").option("-b --bucket [bucket]", "上传文件要存储到的Bucket").option("-k --key [key]", "文件(文件夹)存储名称").option("--withsubdir", "是否上传子文件夹").option("-r --region [region]", "目标Bucket所在的Region").option("-a --acl [ACL]", "上传文件的访问控制权限").action(function(options) { | ||
program.command('upload').description('上传文件或者文件夹').option("-p --path [path]", "选择要上传的文件的地址").option("-b --bucket [bucket]", "上传文件要存储到的Bucket").option("-k --key [key]", "文件(文件夹)存储名称").option("--withsubdir", "是否上传子文件夹").option("-r --region [region]", "目标Bucket所在的Region").action(function(options) { | ||
upload(options); | ||
@@ -281,3 +274,2 @@ }); | ||
var regionStr = options.region || nconf.get('REGION') || ''; | ||
var aclStr = options.acl || ''; | ||
@@ -367,14 +359,4 @@ if (akStr === '' || skStr === '') { | ||
} else { | ||
check.region(regionStr); | ||
callback(null, regionStr); | ||
} | ||
}, | ||
function(callback) { | ||
if (!aclStr) { | ||
var acl = 'private'; //默认 | ||
callback(null, acl); | ||
} else { | ||
check.acl(aclStr); | ||
callback(null, aclStr); | ||
} | ||
}], function(err, results) { | ||
@@ -389,3 +371,2 @@ if (err) { | ||
var region = results[2]; | ||
var acl = results[3]; | ||
nconf.set('BUCKET', bucket); | ||
@@ -406,3 +387,2 @@ nconf.set('REGION',region); | ||
Key: key, | ||
ACL: acl, | ||
fileSetting: { | ||
@@ -409,0 +389,0 @@ isDeep: withsubdir, |
@@ -54,3 +54,3 @@ # KS3 命令行文档 | ||
``` | ||
ks3 upload -p [path] -b [bucket] -k [key] --withsubdir -r [region] -a [ACL] | ||
ks3 upload -p [path] -b [bucket] -k [key] --withsubdir -r [region] | ||
``` | ||
@@ -67,4 +67,2 @@ `-p --path` : 开发者制定要上传文件夹或者文件的地址 | ||
`-a --acl`: 文件的访问控制权限(ACL),有效值为: public-read | private | ||
例如: | ||
@@ -71,0 +69,0 @@ |
@@ -1,6 +0,1 @@ | ||
0.4.2 / 2016-08-15 | ||
================== | ||
* 上传文件时支持通过-a选项设置访问控制权限(ACL) | ||
0.4.0 / 2016-08-05 | ||
@@ -7,0 +2,0 @@ ================== |
@@ -348,2 +348,3 @@ var config = require('../../config'); | ||
debug('使用`简单上传` 文件:' + file); | ||
var retry = 3; | ||
self.object.put({ | ||
@@ -354,3 +355,13 @@ filePath: file, | ||
}, | ||
function(err, data, res) { | ||
function _cb(err, data, res) { | ||
if (err && retry-- > 0) { | ||
console.log('出现错误', err); | ||
console.log('第' + (3-retry) + '次重试', file); | ||
self.object.put({ | ||
filePath: file, | ||
Key: key2, | ||
ACL: params.ACL | ||
}, _cb); | ||
return; | ||
} | ||
debug('index:', index, 'count:', count) | ||
@@ -357,0 +368,0 @@ if (index >= count) { |
{ | ||
"name": "ks3", | ||
"version": "0.4.2", | ||
"version": "0.5.0", | ||
"description": "本代码库为`金山云存储KS3`服务.主要提供`KS3 nodejs SDK`和`命令行工具`.", | ||
@@ -16,3 +16,3 @@ "main": "index.js", | ||
}, | ||
"keywords" : [ | ||
"keywords": [ | ||
"ks3", | ||
@@ -25,4 +25,4 @@ "ksyun", | ||
{ | ||
"name":"chenjin", | ||
"email":"chenjin@kingsoft.com" | ||
"name": "chenjin", | ||
"email": "chenjin@kingsoft.com" | ||
} | ||
@@ -29,0 +29,0 @@ ], |
@@ -99,3 +99,3 @@ /* 测试异步数据处理相关操作 */ | ||
////视频切片 | ||
it.only('avm3u8 : convert a video to HTTP Live Streaming format', function (done) { | ||
it('avm3u8 : convert a video to HTTP Live Streaming format', function (done) { | ||
var client = new KS3(ak, sk, bucketName,'HANGZHOU'); | ||
@@ -118,3 +118,3 @@ var key = 'a.mp4'; | ||
//等10s转换时间 | ||
setTimeout(getAVInfo, 5000); | ||
setTimeout(getAVInfo, 10000); | ||
@@ -121,0 +121,0 @@ //通过queryadp获取生成的文件的元数据验证处理是否成功 |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
0
100
36
6
6985941
50
3508