Skip to content

Update Project #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 140 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
eeb5b3f
定义完成
xialeistudio Jun 27, 2017
98bf956
定义完成
xialeistudio Jun 27, 2017
826fb25
add http & https proxy mentioned in issue 192
jemygraw Jun 27, 2017
a9a1bef
update changelog for http&https proxy
jemygraw Jun 27, 2017
c46790f
fix import problem
jemygraw Jun 27, 2017
6290e55
enable http proxy
jemygraw Jun 27, 2017
192aa1e
fix http proxy, disable the config.useHttpsDomain
jemygraw Jun 27, 2017
e405768
Merge pull request #247 from xialeistudio/feature/typescript-definetion
jemygraw Jun 27, 2017
80a3a1f
fix: fix error of implements
ruiming Jun 29, 2017
dfaddfd
Merge pull request #250 from ruiming/patch-1
jemygraw Jun 29, 2017
c7f7ab1
Update resume_upload_simple.js
jemygraw Jun 30, 2017
70435f6
Update resume_upload_simple.js
jemygraw Jun 30, 2017
f35030d
fix zone callback error
jemygraw Jul 12, 2017
cc34c99
publish 7.0.5
jemygraw Jul 12, 2017
b5c38af
修正Typescript 2.4.1 下 putFile, putFileWithoutKey, changeMime 缺少返回申明报错问题
Jul 17, 2017
3b3d97d
Merge pull request #254 from xemean/Arthur-Xie
jemygraw Jul 18, 2017
17a4cf7
[ISSUE-256] fix url anti leech filename urlencode problem
jemygraw Aug 13, 2017
1d72876
publish 7.0.6
jemygraw Aug 13, 2017
34a8d95
update changelog
jemygraw Aug 13, 2017
462aec6
update examples to use bucket from env variables
jemygraw Aug 20, 2017
9cdd687
check crc32 for each block
jemygraw Aug 20, 2017
1e8bbc5
remove the wrong logic to calc crc32 from form upload
jemygraw Aug 20, 2017
81e37cb
add crc32 check for form upload
jemygraw Aug 20, 2017
0369cee
Update resume.js
willnewii Aug 22, 2017
16c49df
fix crc32 issue
Aug 23, 2017
87ec967
Merge pull request #261 from GuGaobai1994/master
jemygraw Aug 23, 2017
2996814
remove useless code and format
jemygraw Aug 23, 2017
7702301
publish v7.0.7
jemygraw Aug 23, 2017
5d40aad
fix the bug of config reference in callback
jemygraw Aug 23, 2017
bd056a7
Update resume.js
jemygraw Aug 28, 2017
31c8723
Merge pull request #260 from willnewii/patch-1
jemygraw Aug 28, 2017
d427958
fix resume upload end event trigger bug
jemygraw Aug 28, 2017
81c2a70
remove the prefop host detection code
jemygraw Sep 24, 2017
7eecf8a
add generate access token of Qiniu type
jemygraw Oct 11, 2017
ed3e977
update change log
jemygraw Oct 11, 2017
85ed408
fix an issue when the last chunk is less than 2056
Oct 17, 2017
a279555
fix an issue when the last chunk is less than 2056
Oct 17, 2017
5ba72af
Merge pull request #268 from GuGaobai1994/master
jemygraw Oct 17, 2017
289c02d
timestamp_antileech
liangchaoboy Oct 18, 2017
3a0352a
Merge pull request #269 from liangchaoboy/timestamp_antileech
jemygraw Oct 18, 2017
b62e2aa
publish v7.1.0
jemygraw Oct 18, 2017
0fcbb86
improve the compatibility of timestamp_antileech
liangchaoboy Oct 22, 2017
5da9c53
Merge pull request #270 from liangchaoboy/timestamp_antileech
jemygraw Oct 24, 2017
ade47b5
fix function prototype error in index.d.ts
jemygraw Oct 30, 2017
069dfa1
Fix hanging when uploading 0 byte file
chrisyip Nov 15, 2017
ba871db
Merge pull request #274 from shimohq/fix-zero-byte-file
jemygraw Nov 16, 2017
406e9b9
safe encode url
helloyou2012 Dec 28, 2017
f37e4cd
Merge pull request #277 from d-band/master
jemygraw Dec 28, 2017
130aeda
correct typescript typedefination
taoqf Jan 9, 2018
a18a082
Merge pull request #278 from taoqf/master
jemygraw Jan 9, 2018
3368e93
rs: add changeHeaders
disoul Jan 10, 2018
72b9936
ts: add changHeaders
disoul Jan 10, 2018
3d0ecff
test: add changeHeaders and changeMime
disoul Jan 10, 2018
f4979d8
remove changeHeaders prefix match
disoul Jan 10, 2018
6f6ce99
test: change test headers
disoul Jan 10, 2018
4a13609
docs: add changeHeaders
disoul Jan 10, 2018
5f27b00
Merge pull request #281 from disoul/feature/changeheaders
jemygraw Jan 22, 2018
5017d7f
publish v7.1.2
jemygraw Jan 25, 2018
4f6d62d
add as0
GuGaobai1994 Feb 8, 2018
847e7f8
Merge pull request #286 from GuGaobai1994/master
jemygraw Feb 20, 2018
7384b60
add singapore zone
jemygraw Mar 1, 2018
1d4a9ec
add qiniuRtc
Apr 19, 2018
0155857
eslint
GuGaobai1994 May 8, 2018
fab2808
remove auto choice
GuGaobai1994 May 8, 2018
568db97
Merge pull request #295 from GuGaobai1994/master
jemygraw May 9, 2018
d15defd
prepare to publish v7.1.4
jemygraw May 9, 2018
3a37f87
refractor the rtc function naming
jemygraw May 9, 2018
468d255
Update README.md
jemygraw May 15, 2018
5945d0b
fix the rs, rsf https default domains for different regions
jemygraw May 18, 2018
ac12d64
[ISSUE-296] fix the mime library security problem
jemygraw May 18, 2018
24c9ce1
update changelog
jemygraw May 18, 2018
8442eaf
fix the mime error after updating the library
jemygraw May 18, 2018
91b81d0
Add changeStatusOp
wong2 May 22, 2018
20a2d63
Merge pull request #299 from wong2/chstatus
jemygraw May 23, 2018
55cc95c
Fix ConfigOptions.zone type
wong2 Jun 8, 2018
6af6139
Remove node.js 4 in travis config
wong2 Jun 8, 2018
5464404
Merge pull request #301 from wong2/ts-declaration-zone
jemygraw Jun 11, 2018
8edba1f
prepare to publish v7.1.8
jemygraw Jun 13, 2018
48f5ca6
fix the bug of resume upload content buffered when stream not closed
jemygraw Jun 14, 2018
30a7280
fix the bug of nodejs stream read chunk size not fixed, which caused …
jemygraw Jun 14, 2018
d94bd4d
add pfops_video_plus.js
liangchaoboy Jun 24, 2018
f6651a6
add pfops_video_plus.js
liangchaoboy Jun 24, 2018
e9f83f4
fix: rtc get return response
disoul Jun 28, 2018
0490fae
test: add rtc test
disoul Jun 28, 2018
520ff28
Merge pull request #303 from disoul/bugs/rtcget
jemygraw Jun 28, 2018
9e493ae
prepare to publish v7.2.1
jemygraw Jun 28, 2018
1674380
fix changelog.md description error
muyu66 Jul 30, 2018
5cbb2a7
use svg
lidaobing Sep 27, 2018
70931e6
Create form_qvm_upload.js
ChinaPoger Nov 14, 2018
a208369
add as0 zone define.
Amastyer Dec 19, 2018
98c7f80
Merge pull request #319 from Amastyer/feature/add_as0_zone_define
longbai Dec 19, 2018
fcf9391
Update util.js
reezon Dec 28, 2018
38c8886
Merge pull request #320 from reezon/patch-1
longbai Dec 29, 2018
4439c75
Update package.json
longbai Dec 29, 2018
617a422
Merge pull request #311 from lidaobing/patch-1
longbai Dec 29, 2018
379fc6c
Merge pull request #306 from muyu66/feature/changelog-fix
longbai Dec 29, 2018
1e67f55
Merge pull request #302 from liangchaoboy/master
longbai Dec 29, 2018
75d86b2
Merge pull request #318 from ChinaPoger/master
longbai Dec 29, 2018
4734174
eslint
longbai Dec 29, 2018
7503a5f
change log
longbai Dec 29, 2018
e28e4b7
bucket operations
Feb 21, 2019
a3b2a89
sytle format
Feb 21, 2019
abcddf6
remove some func
Feb 21, 2019
b45d298
Merge pull request #328 from JemyCheung/storage
longbai Feb 21, 2019
a22997a
listv2
Apr 3, 2019
e30efbd
listv2
Apr 3, 2019
e1b7379
listv2
Apr 3, 2019
8575531
Merge pull request #330 from JemyCheung/listv2
longbai Apr 3, 2019
50dcf9b
bucketOp
Apr 12, 2019
a5654f4
bucketop
Apr 12, 2019
e9789ad
Merge pull request #332 from JemyCheung/bucketop
longbai Apr 15, 2019
25cf410
fix Config.useCdnDomain
sxci May 30, 2019
a0b6b0d
Merge pull request #334 from sxci/update_config_options
longbai May 30, 2019
bc2b777
up readme
Jun 24, 2019
131573a
Merge pull request #337 from JemyCheung/bucketop
longbai Jun 24, 2019
31a3d5f
query
Oct 10, 2019
f1286da
qiniu/millisecond;
Oct 10, 2019
a0c858c
Merge pull request #345 from JemyCheung/master
longbai Oct 11, 2019
8ccadb0
bug fix: chunk size is not always equal to BLOCK_SIZE
helloyou2012 Oct 11, 2019
51b1dce
eslint config fixed
helloyou2012 Oct 12, 2019
1af8889
update dependents to latest
helloyou2012 Oct 12, 2019
93ae9f0
bug fix: url.parse to new url.URL
helloyou2012 Oct 12, 2019
c9f9891
finishedBlkPutRets bug fixed
helloyou2012 Oct 12, 2019
c32d858
ReadableStream not have close() function
helloyou2012 Oct 12, 2019
497c42a
update should version to latest
helloyou2012 Oct 12, 2019
e5d7081
query to search
helloyou2012 Oct 14, 2019
e238127
Merge pull request #346 from helloyou2012/master
bachue Oct 16, 2019
f1636ce
fix unexpected file size
Oct 16, 2019
3fa0644
- log
Oct 16, 2019
04fc66c
Merge pull request #349 from JemyCheung/master
bachue Oct 16, 2019
3c6aa17
compute block count with Math.ceil & add putStream test & add cancel …
helloyou2012 Oct 16, 2019
7fe908e
cover use nyc & add some test cases
helloyou2012 Oct 17, 2019
4caaae4
add some test cases
helloyou2012 Oct 17, 2019
0c566e7
change log dates
helloyou2012 Oct 17, 2019
1c9c416
test privateDownloadUrl bug fixed
helloyou2012 Oct 18, 2019
ccb756e
Merge pull request #350 from helloyou2012/master
bachue Oct 18, 2019
7a40810
for test
Oct 18, 2019
814e620
for test
Oct 18, 2019
180eff8
rs.test
Oct 18, 2019
5c3f9c4
Merge pull request #351 from JemyCheung/master
bachue Oct 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
"env": {
"node": true,
"mocha": true
},
"extends": "standard",
"parserOptions": {
"ecmaVersion": 6
},
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"eqeqeq": [0]
}
};
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ lib-cov
*.out
*.pid
*.gz
test-env.sh

pids
logs
Expand All @@ -18,3 +19,7 @@ results
node_modules
npm-debug.log
test/config.js
package-lock.json

coverage/
.nyc_output/
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
test/
test-env.sh
.travis.yml
.eslintrc.js
coverage.html
gopher.png
lib-cov/
Makefile
docs/
examples/
coverage/
.nyc_output/
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
language: node_js
node_js:
- '4'
- '6'
- '8'
- "6"
- "8"
- "9"
- "10"
- "11"
before_script:
- export is_travis=true
deploy:
Expand Down
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
## CHANGE LOG

## v7.2.2
- 一些log输出问题,travis增加eslint 检查

## v7.2.1
- 修复rtc获取回复存在的问题

## v7.2.0
- 修复node的stream读取的chunk大小比较随意的问题

## v7.1.9
- 修复新版node下resume up方式文件内容被缓存而导致的上传失败

## v7.1.8
- 修复 index.d.ts 文件中zone的设置

## v7.1.7
- 修复form上传在升级mime库后的错误

## v7.1.6
- 修复rs和rsf的https默认域名
- 升级修复mime库的安全风险

## v7.1.5
- 增加连麦功能

## v7.1.3
- 增加新加坡机房

## v7.1.2
- 增加自定义资源访问响应头部的功能
- 改进时间戳签名方法,支持复杂urlencode

### v7.1.1
- 修复 index.d.ts 中的函数声明错误

### v7.1.0
- 修复时间戳防盗链中存在特殊字符引发的签名错误
- 修复分片上传的时候最后一块小于2056字节引发的错误

### v7.0.9
- 增加Qiniu方式的管理凭证生成方法以支持新的产品鉴权

### v7.0.8
- 修复分片上传小文件的时候文件读取end的事件bug

### v7.0.7
- 给form upload添加默认的crc32校验以避免网络层面的字节反转导致上传内容不正确
- 修复resume upload在上传小文件的时候出现的上传失败情况

### v7.0.6
- 修复时间戳防盗链算法中对文件名的urlencode不兼容问题
- 发布index.d.ts文件

### v7.0.5
- 修复zone获取失败时callbackFunc不存在的问题
- 增加分片上传的时候的progressCallback

### v7.0.4
- 增加http&https代理功能

### v7.0.2
- 修复cdn刷新文件和目录中方法引用错误

Expand Down
23 changes: 6 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
TESTS = test/*.test.js
TIMEOUT = 25000
REPORTER = spec
MOCHA_OPTS =
test:
@NODE_ENV=test ./node_modules/.bin/mocha \
--require should \
--reporter $(REPORTER) \
--timeout $(TIMEOUT) \
$(MOCHA_OPTS) \
$(TESTS)
@npm test

test-cov:
@rm -f coverage.html
@$(MAKE) test MOCHA_OPTS='--require blanket' REPORTER=html-cov > coverage.html
#@$(MAKE) test MOCHA_OPTS='--require blanket' REPORTER=travis-cov
@ls -lh coverage.html
test-cov: clean
@npm run cover
@npm run report

clean:
rm -rf ./lib-cov coverage.html
rm -rf ./coverage ./.nyc_output

.PHONY: test-cov lib-cov test
.PHONY: test-cov test
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Qiniu Resource Storage SDK for Node.js
# Qiniu Cloud SDK for Node.js

[![@qiniu on weibo](http://img.shields.io/badge/weibo-%40qiniutek-blue.svg)](http://weibo.com/qiniutek)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md)
[![Build Status](https://travis-ci.org/qiniu/nodejs-sdk.v6.png?branch=master)](https://travis-ci.org/qiniu/nodejs-sdk.v6)
[![Code Climate](https://codeclimate.com/github/qiniu/nodejs-sdk.png)](https://codeclimate.com/github/qiniu/nodejs-sdk)
[![Build Status](https://api.travis-ci.org/qiniu/nodejs-sdk.svg?branch=master)](https://travis-ci.org/qiniu/nodejs-sdk)
[![Code Climate](https://codeclimate.com/github/qiniu/nodejs-sdk.svg)](https://codeclimate.com/github/qiniu/nodejs-sdk)
[![Latest Stable Version](https://img.shields.io/npm/v/qiniu.svg)](https://www.npmjs.com/package/qiniu)

## 下载
Expand All @@ -18,7 +18,7 @@ $ npm install qiniu

### 从 release 版本下载

下载地址:https://github.com/qiniu/nodejs-sdk/releases
下载地址:[https://github.com/qiniu/nodejs-sdk/releases](https://github.com/qiniu/nodejs-sdk/releases)

这里可以下载到旧版本的SDK,release 版本有版本号,有 [CHANGELOG](https://github.com/qiniu/nodejs-sdk/blob/master/CHANGELOG.md),使用规格也会比较稳定。

Expand All @@ -28,7 +28,14 @@ $ npm install qiniu

## 使用

参考文档:[七牛云存储 Node.js SDK 使用指南](http://developer.qiniu.com/kodo/sdk/nodejs)
参考文档:[七牛云存储 Node.js SDK 使用指南](http://developer.qiniu.com/kodo/sdk/nodejs)

## 测试
```
$ cd ./test/
$ source test-env.sh
$ mocha --grep 'bucketinfo'
```

## 贡献代码

Expand Down
24 changes: 24 additions & 0 deletions docs/nodejs-sdk-v7.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,30 @@ bucketManager.changeMime(bucket, key, newMime, function(err, respBody, respInfo)
});
```

<a id="rs-chgm-h"></a>
## 修改文件Headers

```
var bucket = 'if-pbl';
var key = 'qiniu.mp4';
var headers = {
'Content-Type': 'application/octet-stream',
'Last-Modified': 'Web, 21 Oct 2015 07:00:00 GMT',
'x-custom-header-xx': 'value',
};

bucketManager.changeHeaders(bucket, key, headers, function(err, respBody, respInfo) {
if (err) {
console.log(err);
//throw err;
} else {
//200 is success
console.log(respInfo.statusCode);
console.log(respBody);
}
});
```

<a id="rs-chtype"></a>
## 修改文件存储类型

Expand Down
24 changes: 24 additions & 0 deletions examples/atlab_check_qiniu_auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const qiniu = require('../index.js');
const proc = require('process');

var accessKey = proc.env.QINIU_ACCESS_KEY;
var secretKey = proc.env.QINIU_SECRET_KEY;

var mac = new qiniu.auth.digest.Mac(accessKey, secretKey);
var reqURL = 'http://serve.atlab.ai/v1/eval/facex-detect';
var contentType = 'application/json';
var reqBody = '{"data":{"uri":"https://ors35x6a7.qnssl.com/atshow-face-detection-20170703/1.png"}}';
var accessToken = qiniu.util.generateAccessTokenV2(mac, reqURL, 'POST', contentType, reqBody);
var headers = {
Authorization: accessToken,
'Content-Type': contentType
};

qiniu.rpc.post(reqURL, reqBody, headers, function (err, body, info) {
if (err) {
console.error(err);
return;
}
console.log(info);
console.log(body);
});
39 changes: 19 additions & 20 deletions examples/bucket_image_unimage.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
const qiniu = require("qiniu");
const proc = require("process");
const qiniu = require('qiniu');
const proc = require('process');

var accessKey = proc.env.QINIU_ACCESS_KEY;
var secretKey = proc.env.QINIU_SECRET_KEY;
var mac = new qiniu.auth.digest.Mac(accessKey, secretKey);
var config = new qiniu.conf.Config();
var bucketManager = new qiniu.rs.BucketManager(mac, config);
var bucket = "if-pbl";
var srcSiteUrl = "http://www.baidu.com/";
var bucket = 'if-pbl';
var srcSiteUrl = 'http://www.baidu.com/';
var srcHost = null;

bucketManager.image(bucket, srcSiteUrl, srcHost, function(err, respBody,
respInfo) {
if (err) {
console.log(err);
//throw err;
} else {
console.log(respInfo.statusCode);

//unimage
bucketManager.unimage(bucket, function(err1, respBody1, respInfo1) {
if (err1) {
throw err;
}
console.log(respInfo1.statusCode);
});
}
bucketManager.image(bucket, srcSiteUrl, srcHost, function (err, respBody,
respInfo) {
if (err) {
console.log(err);
// throw err;
} else {
console.log(respInfo.statusCode);

// unimage
bucketManager.unimage(bucket, function (err1, respBody1, respInfo1) {
if (err1) {
throw err;
}
console.log(respInfo1.statusCode);
});
}
});
23 changes: 12 additions & 11 deletions examples/cdn_create_timestamp_antileech_url.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
const qiniu = require("qiniu");
const qiniu = require('qiniu');

var domain = 'http://sq.qiniuts.com';
var fileName = '1491535764000.png';
// 加密密钥
var encryptKey = '**';

var query = 'imageView2/2/w/480/format/jpg';

var domain = 'http://sg.xiaohongshu.com';
var fileName = 'github.png';
//加密密钥
var encryptKey = 'xxx';
var query = {
'name': 'qiniu',
'location': 'shanghai'
};
var deadline = parseInt(Date.now() / 1000) + 3600;

var cdnManager = new qiniu.cdn.CdnManager(null);

var finalUrl = cdnManager.createTimestampAntiLeechUrl(domain, fileName, query,
encryptKey,
deadline);
encryptKey, deadline);

console.log(finalUrl);
Loading