Comparing version 6.1.1 to 6.1.3
## CHANGE LOG | ||
### v6.1.3 | ||
2014-4-03 issue [#102](https://github.com/qiniu/nodejs-sdk/pull/102) | ||
- [#98] 增加pfop 功能 | ||
- [#99] 增加针对七牛callback的检查 | ||
### v6.1.2 | ||
2014-2-17 issue [#96](https://github.com/qiniu/nodejs-sdk/pull/96) | ||
- Content-Length = 0 时的细节修复 | ||
### v6.1.1 | ||
@@ -4,0 +18,0 @@ |
@@ -10,2 +10,4 @@ | ||
conf: require(libpath + '/conf.js'), | ||
rpc: require(libpath + '/rpc.js'), | ||
util: require(libpath + '/util.js') | ||
}; |
{ | ||
"name": "qiniu", | ||
"version": "6.1.1", | ||
"version": "6.1.3", | ||
"description": "Node wrapper for Qiniu Resource (Cloud) Storage API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,3 +5,3 @@ | ||
exports.USER_AGENT = 'qiniu nodejs-sdk v6.0.0'; | ||
exports.USER_AGENT = 'qiniu nodejs-sdk v6.1.3'; | ||
@@ -11,2 +11,2 @@ exports.UP_HOST = 'http://up.qbox.me'; | ||
exports.RSF_HOST = 'http://rsf.qbox.me'; | ||
exports.RPC_TIMEOUT = 3600000; // default rpc timeout: one hour | ||
exports.RPC_TIMEOUT = 3600000; // default rpc timeout: one hour |
@@ -0,2 +1,5 @@ | ||
var util = require('./util'); | ||
var rpc = require('./rpc'); | ||
var querystring = require('querystring'); | ||
@@ -6,2 +9,3 @@ exports.ImageView = ImageView; | ||
exports.Exif = Exif; | ||
exports.pfop = pfop; | ||
@@ -53,1 +57,25 @@ function ImageView(mode, width, height, quality, format) { | ||
function pfop(bucket, key, fops, opts, onret) { | ||
opts = opts || {}; | ||
param = { | ||
bucket: bucket, | ||
key: key, | ||
fops: fops | ||
}; | ||
if (opts.notifyURL) { | ||
param.notifyURL = opts.notifyURL; | ||
} else { | ||
param.notifyURL = 'www.test.com'; | ||
} | ||
if (opts.force) { | ||
param.force = 1; | ||
} | ||
var uri = 'http://api.qiniu.com/pfop/'; | ||
var body = querystring.stringify(param); | ||
var auth = util.generateAccessToken(uri, body); | ||
rpc.postWithForm(uri, body, auth, onret); | ||
} | ||
@@ -37,25 +37,25 @@ var urllib = require('urllib'); | ||
var content = null; | ||
if (Buffer.isBuffer(form) || typeof form === 'string') { | ||
content = form; | ||
form = null; | ||
} | ||
var req = urllib.request(uri, { | ||
var data = { | ||
headers: headers, | ||
method: 'POST', | ||
content: content, | ||
dataType: 'json', | ||
timeout: conf.RPC_TIMEOUT, | ||
}, function (err, result, res) { | ||
if (err) { | ||
err.code = res && res.statusCode || -1; | ||
}; | ||
if (Buffer.isBuffer(form) || typeof form === 'string') { | ||
data.content = form; | ||
} else if (form) { | ||
data.stream = form; | ||
} else { | ||
data.headers['Content-Length'] = 0; | ||
}; | ||
var req = urllib.request(uri, data, function(err, result, res) { | ||
var rerr = null; | ||
if (err || Math.floor(res.statusCode/100) !== 2) { | ||
rerr = {code: res&&res.statusCode||-1, error: err||result.error||''}; | ||
} | ||
onresp(err, result, res); | ||
onresp(rerr, result, res); | ||
}); | ||
if (form) { | ||
form.pipe(req); | ||
} | ||
} | ||
@@ -186,2 +186,8 @@ | ||
} | ||
if (this.persistentOps != null) { | ||
flags['persistentOps'] = this.persistentOps; | ||
} | ||
if (this.persistentNotifyUrl != null) { | ||
flags['persistentNotifyUrl'] = this.persistentNotifyUrl; | ||
} | ||
flags['deadline'] = this.expires + Math.floor(Date.now() / 1000); | ||
@@ -188,0 +194,0 @@ return flags; |
@@ -7,2 +7,4 @@ var fs = require('fs'); | ||
exports.isQiniuCallback = isQiniuCallback; | ||
// ------------------------------------------------------------------------------------------ | ||
@@ -45,1 +47,7 @@ // func encode | ||
} | ||
function isQiniuCallback(path, body, callbackAuth) { | ||
var auth = exports.generateAccessToken(path, body) | ||
return auth === callbackAuth; | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
18910
501
10
1