cos-nodejs-sdk-v5
Advanced tools
Comparing version 2.2.0 to 2.2.2
@@ -34,2 +34,14 @@ var fs = require('fs'); | ||
function getObjectUrl() { | ||
var url = cos.getObjectUrl({ | ||
Bucket: config.Bucket, // Bucket 格式:test-1250000000 | ||
Region: config.Region, | ||
Key: '1mb.zip', | ||
Expires: 60, | ||
}, function (err, data) { | ||
console.log(err || data); | ||
}); | ||
console.log(url); | ||
} | ||
function putBucket() { | ||
@@ -543,2 +555,3 @@ cos.putBucket({ | ||
// getAuth(); | ||
// getObjectUrl(); | ||
// putBucket(); | ||
@@ -545,0 +558,0 @@ // getBucket(); |
@@ -0,0 +0,0 @@ /** |
{ | ||
"name": "cos-nodejs-sdk-v5", | ||
"version": "2.2.0", | ||
"version": "2.2.2", | ||
"description": "cos nodejs sdk v5", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,3 +18,2 @@ var fs = require('fs'); | ||
var StorageClass = params.StorageClass || 'Standard'; | ||
var SliceCount; | ||
var FileSize; | ||
@@ -106,3 +105,2 @@ var self = this; | ||
FileSize = params.ContentLength; | ||
SliceCount = Math.ceil(FileSize / SliceSize); | ||
@@ -109,0 +107,0 @@ if (FileSize === 0) { |
@@ -118,3 +118,3 @@ var fs = require('fs'); | ||
var size = 0; | ||
var size; | ||
if (params.Body && params.Body.size !== undefined) { | ||
@@ -136,2 +136,3 @@ size = params.Body.size; | ||
if (params.ContentLength === undefined) params.ContentLength = size; | ||
size = size || 0; | ||
params.TaskId = id; | ||
@@ -138,0 +139,0 @@ |
@@ -19,3 +19,2 @@ 'use strict'; | ||
var getAuth = function (opt) { | ||
opt = opt || {}; | ||
@@ -59,8 +58,9 @@ | ||
var now = parseInt(new Date().getTime() / 1000) - 1; | ||
var expired = now; | ||
var exp = now; | ||
if (opt.expires === undefined) { | ||
expired += 3600; // 签名过期时间为当前 + 3600s | ||
var Expires = opt.Expires || opt.expires; | ||
if (Expires === undefined) { | ||
exp += 900; // 签名过期时间为当前 + 900s | ||
} else { | ||
expired += (opt.expires * 1) || 0; | ||
exp += (Expires * 1) || 0; | ||
} | ||
@@ -71,4 +71,4 @@ | ||
var qAk = SecretId; | ||
var qSignTime = now + ';' + expired; | ||
var qKeyTime = now + ';' + expired; | ||
var qSignTime = now + ';' + exp; | ||
var qKeyTime = now + ';' + exp; | ||
var qHeaderList = getObjectKeys(headers).join(';').toLowerCase(); | ||
@@ -279,3 +279,3 @@ var qUrlParamList = getObjectKeys(queryParams).join(';').toLowerCase(); | ||
var res = apiFn.call(this, params, callback); | ||
if (apiName === 'getAuth') { | ||
if (apiName === 'getAuth' || apiName === 'getObjectUrl') { | ||
return res; | ||
@@ -282,0 +282,0 @@ } |
Sorry, the diff of this file is too big to display
211244
5235