qiniu.js
618 Bytes
/**
*
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 16/8/19
*/
'use strict';
import qn from 'qn';
import Promise from 'bluebird';
import _ from 'lodash';
const config = {
accessKey: 'cY9B5ZgON_7McTS5zV5nTeRyQ98MOcVD7W4eGVbE',
secretKey: 'RduqgmK7cAtaQvdIa1ax_zzmMsnv9ac-Ka0uF6wG',
origin: 'http://cdn.yoho.cn',
bucket: 'yohocdn'
};
const _default = Promise.promisifyAll(qn.create(config));
_default.key = function(key) {
let _conifg = _.clone(config);
_conifg.bucket = _conifg.bucket + ":" + key;
return Promise.promisifyAll(qn.create(_conifg));
};
export default _default;