Skip to content

Commit 757dce9

Browse files
authored
Merge pull request #2 from tomleader/master
cos-nodejs-sdk-3.3
2 parents 638687a + a31ab19 commit 757dce9

File tree

3 files changed

+478
-206
lines changed

3 files changed

+478
-206
lines changed

qcloud_cos/README.md renamed to README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ qcloud.conf.setAppInfo('100000', 'AKIDoooooooooooooooooooooooooooooooo', 'ROllll
1818

1919
/*
2020
* 各接口的callback 为单个参数的function: function(ret){}
21-
* ret 为 {'httpcode':200,'code':0,'message':'ok','data':{}} 的对象,其中data的内容依接口有所不同
21+
* ret 为 {'code':0,'message':'ok','data':{}} 的对象,其中data的内容依接口有所不同
2222
*/
2323
//上传文件
24-
qcloud.cos.upload('/tmp/test.txt', 'bucket', 'text/1.txt', function(ret){
24+
qcloud.cos.upload('/tmp/test.txt', 'bucket', 'text/1.txt','new myattr',1, function(ret){
2525
if (ret.code != 0) {
2626
console.log(ret);
2727
}else{
@@ -48,4 +48,14 @@ qcloud.cos.list('bucket', '/', 20, 'eListFileOnly');
4848
//获取指定目录下以'abc'开头的文件
4949
qcloud.cos.prefixSearch('bucket', '/firstDir/', 'abc', 20, 'eListFileOnly');
5050

51+
//设置文件权限以及自定义header
52+
var headers = {
53+
"Cache-Control": "no-cache",
54+
"Content-Type" : "application/json",
55+
"Content-Encoding" : "utf-8"
56+
};
57+
58+
qcloud_cos.cos.updateFile('0001', '123/test_slice.dat', 'newattr', 'eWRPrivate', headers, function(ret) {console.log(ret)});
59+
5160
```
61+

qcloud_cos/lib/conf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var fs = require('fs');
22
var path = require('path');
3-
var os = require('os');
3+
44

55
// 请到app.qcloud.com查看您对应的appid相关信息并填充
66
exports.APPID = '您的APPID';
@@ -9,7 +9,7 @@ exports.SECRET_KEY = '您的SECRET_KEY';
99

1010
var pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../', 'package.json')));
1111
var ua = function() {
12-
return 'Qcloud-Cos-Nodejs/' + pkg.version + ' (' + os.type() + '; ' + os.platform() + '; ' + os.arch() + '; ) ';
12+
return 'cos-node-sdk-'+pkg.version;
1313
}
1414

1515
// 签名的有效时间

0 commit comments

Comments
 (0)