Comparing version 6.1.6 to 6.1.7
## CHANGE LOG | ||
### v6.1.7 | ||
2015-05-09 | ||
- 上传策略增加 callbackHost、persistentPipeline, callbackFetchKey | ||
- 增加fetch 函数 | ||
- imageview -> imageview2 | ||
### v6.1.6 | ||
@@ -7,3 +16,3 @@ | ||
- 增加fsizelimit, insertonly | ||
- 上传策略增加fsizelimit, insertonly | ||
@@ -10,0 +19,0 @@ |
{ | ||
"name": "qiniu", | ||
"version": "6.1.6", | ||
"version": "6.1.7", | ||
"description": "Node wrapper for Qiniu Resource (Cloud) Storage API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,3 +9,3 @@ var fs = require('fs'); | ||
var pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../', 'package.json'))); | ||
var ua = function(){ | ||
var ua = function() { | ||
return 'QiniuNodejs/' + pkg.version + ' (' + os.type() + '; ' + os.platform() + '; ' + os.arch() + '; )'; | ||
@@ -19,2 +19,3 @@ } | ||
exports.RSF_HOST = 'http://rsf.qbox.me'; | ||
exports.API_HOST = 'http://api.qiniu.com'; | ||
exports.RPC_TIMEOUT = 3600000; // default rpc timeout: one hour |
var util = require('./util'); | ||
var rpc = require('./rpc'); | ||
var conf = require('./conf'); | ||
@@ -20,3 +21,3 @@ var querystring = require('querystring'); | ||
ImageView.prototype.makeRequest = function(url) { | ||
url += '?imageView/' + this.mode; | ||
url += '?imageView2/' + this.mode; | ||
@@ -42,4 +43,3 @@ if (this.width > 0) { | ||
function ImageInfo() { | ||
} | ||
function ImageInfo() {} | ||
@@ -50,4 +50,3 @@ ImageInfo.prototype.makeRequest = function(url) { | ||
function Exif() { | ||
} | ||
function Exif() {} | ||
@@ -76,4 +75,7 @@ Exif.prototype.makeRequest = function(url) { | ||
} | ||
if (opts.pipeline) { | ||
param.pipeline = opts.pipeline; | ||
} | ||
var uri = 'http://api.qiniu.com/pfop/'; | ||
var uri = conf.API_HOST + '/pfop/'; | ||
var body = querystring.stringify(param); | ||
@@ -83,2 +85,1 @@ var auth = util.generateAccessToken(uri, body); | ||
} | ||
104
qiniu/rs.js
@@ -1,2 +0,1 @@ | ||
var url = require('url'); | ||
@@ -61,2 +60,9 @@ var crypto = require('crypto'); | ||
Client.prototype.fetch = function(url, bucket, key, onret) { | ||
var bucketUri = getEncodedEntryUri(bucket, key); | ||
var fetchUrl = util.urlsafeBase64Encode(url); | ||
var uri = 'http://iovip.qbox.me/fetch/' + fetchUrl + '/to/' + bucketUri; | ||
var digest = util.generateAccessToken(uri, null); | ||
rpc.postWithoutForm(uri, digest, onret); | ||
} | ||
@@ -139,13 +145,31 @@ function Entry(hash, fsize, putTime, mimeType, endUser) { | ||
// @gist PutPolicy | ||
function PutPolicy(scope, callbackUrl, callbackBody, returnUrl, returnBody, | ||
asyncOps, endUser, expires, persistentOps, persistentNotifyUrl) { | ||
this.scope = scope || null; | ||
this.callbackUrl = callbackUrl || null; | ||
this.callbackBody = callbackBody || null; | ||
this.returnUrl = returnUrl || null; | ||
this.returnBody = returnBody || null; | ||
this.endUser = endUser || null; | ||
this.expires = expires || 3600; | ||
this.persistentOps = persistentOps || null; | ||
this.persistentNotifyUrl = persistentNotifyUrl || null; | ||
function PutPolicy(putPolicyObj) { | ||
if (typeof putPolicyObj !== 'object') { | ||
return false; | ||
} | ||
this.scope = putPolicyObj.scope || null; | ||
this.expires = putPolicyObj.expires || 3600; | ||
this.insertOnly = putPolicyObj.insertOnly || null; | ||
this.saveKey = putPolicyObj.saveKey || null; | ||
this.endUser = putPolicyObj.endUser || null; | ||
this.returnUrl = putPolicyObj.returnUrl || null; | ||
this.returnBody = putPolicyObj.returnBody || null; | ||
this.callbackUrl = putPolicyObj.callbackUrl || null; | ||
this.callbackHost = putPolicyObj.callbackHost || null; | ||
this.callbackBody = putPolicyObj.callbackBody || null; | ||
this.persistentOps = putPolicyObj.persistentOps || null; | ||
this.persistentNotifyUrl = putPolicyObj.persistentNotifyUrl || null; | ||
this.persistentPipeline = putPolicyObj.persistentPipeline || null; | ||
this.fsizeLimit = putPolicyObj.fsizeLimit || null; | ||
this.detectMime = putPolicyObj.detectMime || null; | ||
this.mimeLimit = putPolicyObj.mimeLimit || null; | ||
} | ||
@@ -166,50 +190,14 @@ // @endgist | ||
PutPolicy.prototype.getFlags = function(putPolicy) { | ||
PutPolicy.prototype.getFlags = function() { | ||
var flags = {}; | ||
if (this.scope != null) { | ||
flags['scope'] = this.scope; | ||
var attrs = ['scope', 'insertOnly', 'saveKey', 'endUser', 'returnUrl', 'returnBody', 'callbackUrl', 'callbackHost', 'callbackBody', 'callbackBodyType', 'callbackFetchKey', 'persistentOps', 'persistentNotifyUrl', 'persistentPipeline', 'fsizeLimit', 'detectMime', 'mimeLimit']; | ||
for (var i = attrs.length - 1; i >= 0; i--) { | ||
if (this[attrs[i]] !== null) { | ||
flags[attrs[i]] = this[attrs[i]]; | ||
} | ||
} | ||
if (this.callbackUrl != null) { | ||
flags['callbackUrl'] = this.callbackUrl; | ||
} | ||
if (this.callbackBody != null) { | ||
flags['callbackBody'] = this.callbackBody; | ||
} | ||
if (this.returnUrl != null) { | ||
flags['returnUrl'] = this.returnUrl; | ||
} | ||
if (this.returnBody != null) { | ||
flags['returnBody'] = this.returnBody; | ||
} | ||
if (this.endUser != null) { | ||
flags['endUser'] = this.endUser; | ||
} | ||
if (this.persistentOps != null) { | ||
flags['persistentOps'] = this.persistentOps; | ||
} | ||
if (this.persistentNotifyUrl != null) { | ||
flags['persistentNotifyUrl'] = this.persistentNotifyUrl; | ||
} | ||
if (this.persistentPipeline != null) { | ||
flags['persistentPipeline'] = this.persistentPipeline; | ||
} | ||
if (this.mimeLimit != null) { | ||
flags['mimeLimit'] = this.mimeLimit; | ||
} | ||
if (this.insertOnly != null) { | ||
flags['insertOnly'] = this.insertOnly; | ||
} | ||
if (this.detectMime != null) { | ||
flags['detectMime'] = this.detectMime; | ||
} | ||
if (this.saveKey != null) { | ||
flags['saveKey'] = this.saveKey; | ||
} | ||
flags['deadline'] = this.expires + Math.floor(Date.now() / 1000); | ||
if (this.fsizeLimit != null) { | ||
flags['fsizeLimit'] = this.fsizeLimit; | ||
} | ||
if (this.insertOnly != null) { | ||
flags['insertOnly'] = this.insertOnly; | ||
} | ||
return flags; | ||
@@ -245,3 +233,3 @@ } | ||
key = new Buffer(key); | ||
return 'http://' + domain + '/' + querystring.escape(key) + (query||''); | ||
return 'http://' + domain + '/' + querystring.escape(key) + (query || ''); | ||
} |
# Qiniu Resource Storage 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.png?branch=master)](https://travis-ci.org/qiniu/nodejs-sdk) | ||
[![Code Climate](https://codeclimate.com/github/qiniu/nodejs-sdk.png)](https://codeclimate.com/github/qiniu/nodejs-sdk) | ||
[![Latest Stable Version](https://img.shields.io/npm/v/qiniu.svg)](https://www.npmjs.com/package/qiniu) | ||
[![Qiniu Logo](http://qiniutek.com/images/logo-2.png)](http://qiniu.com/) | ||
## 下载 | ||
@@ -44,3 +45,3 @@ | ||
Copyright (c) 2013 qiniu.com | ||
Copyright (c) 2014 qiniu.com | ||
@@ -47,0 +48,0 @@ 基于 MIT 协议发布: |
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
26357
50
508