Comparing version 4.8.0 to 4.9.0
4.9.0 / 2017-07-28 | ||
================== | ||
* feat: support oss.append (#275) | ||
* test: add node 8 | ||
* test: skip callbackurl test cases | ||
* test: set default platform on user-agent | ||
* docs: Document `secure` option when creating bucket store. (#252) | ||
* chore: add dist build files | ||
4.8.0 / 2017-01-19 | ||
@@ -3,0 +13,0 @@ ================== |
@@ -49,2 +49,3 @@ 'use strict'; | ||
this.ctx = ctx; | ||
this.userAgent = this._getUserAgent(); | ||
} | ||
@@ -69,3 +70,3 @@ | ||
for (const key in options) { | ||
for (var key in options) { | ||
if (options[key] === undefined) continue; | ||
@@ -208,4 +209,9 @@ opts[key] = options[key]; | ||
if (subresList.length > 0) { | ||
subresList = subresList.sort(function (a, b) { | ||
return a > b; | ||
}); | ||
resourceStr += '?' + subresList.join('&'); | ||
} | ||
debug('CanonicalizedResource: %s', resourceStr); | ||
params.push(resourceStr); | ||
@@ -225,8 +231,6 @@ var stringToSign = params.join('\n'); | ||
proto.createRequest = function createRequest(params) { | ||
var userAgent = this._userAgent(); | ||
var headers = { | ||
'x-oss-date': dateFormat(new Date(), 'UTC:ddd, dd mmm yyyy HH:MM:ss \'GMT\''), | ||
'x-oss-user-agent': userAgent, | ||
'User-Agent': userAgent | ||
'x-oss-user-agent': this.userAgent, | ||
'User-Agent': this.userAgent | ||
}; | ||
@@ -391,6 +395,9 @@ | ||
proto._userAgent = function _userAgent() { | ||
var agent = (process && process.browser) ? 'js' : 'nodejs'; | ||
proto._getUserAgent = function _getUserAgent() { | ||
var agent = (process && process.browser) ? 'js' : 'nodejs'; | ||
var sdk = 'aliyun-sdk-' + agent + '/' + pkg.version; | ||
var plat = platform.description; | ||
if (!plat && process) { | ||
plat = 'Node.js ' + process.version.slice(1) + ' on ' + process.platform + ' ' + process.arch; | ||
} | ||
@@ -397,0 +404,0 @@ return sdk + ' ' + plat; |
@@ -15,3 +15,5 @@ 'use strict'; | ||
var mime = require('mime'); | ||
var assert = require('assert'); | ||
var proto = exports; | ||
@@ -23,2 +25,23 @@ | ||
/** | ||
* append an object from String(file path)/Buffer/ReadableStream | ||
* @param {String} name the object key | ||
* @param {Mixed} file String(file path)/Buffer/ReadableStream | ||
* @param {Object} options | ||
* @return {Object} | ||
*/ | ||
proto.append = function* (name, file, options) { | ||
options = options || {}; | ||
if (options.position === undefined) options.position = '0'; | ||
options.subres = { | ||
append: '', | ||
position: options.position, | ||
}; | ||
options.method = 'POST'; | ||
var result = yield this.put(name, file, options); | ||
result.nextAppendPosition = result.res.headers['x-oss-next-append-position']; | ||
return result; | ||
} | ||
/** | ||
@@ -51,3 +74,4 @@ * put an object from String(file path)/Buffer/ReadableStream | ||
var params = this._objectRequestParams('PUT', name, options); | ||
var method = options.method || 'PUT'; | ||
var params = this._objectRequestParams(method, name, options); | ||
params.mime = options.mime; | ||
@@ -89,4 +113,6 @@ params.content = content; | ||
this._convertMetaToHeaders(options.meta, options.headers); | ||
var params = this._objectRequestParams('PUT', name, options); | ||
var method = options.method || 'PUT'; | ||
var params = this._objectRequestParams(method, name, options); | ||
params.mime = options.mime; | ||
@@ -93,0 +119,0 @@ params.stream = stream; |
{ | ||
"name": "ali-oss", | ||
"version": "4.8.0", | ||
"version": "4.9.0", | ||
"description": "aliyun oss(open storage service) node client", | ||
@@ -10,3 +10,3 @@ "main": "lib/client.js", | ||
"scripts": { | ||
"test": "mocha -t 30000 -r thunk-mocha -r should test/*.test.js", | ||
"test": "mocha -t 60000 -r thunk-mocha -r should test/*.test.js", | ||
"test-cov": "istanbul cover node_modules/.bin/_mocha -- -R dot -t 60000 -r thunk-mocha -r should test/*.test.js", | ||
@@ -13,0 +13,0 @@ "jshint": "jshint .", |
Sorry, the diff of this file is too big to display
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
142441
2068
2158