项目需要写了一个把网络图片直接存到七牛的lib,分享出来~
https://github.com/ltebean/src2qiniu
用法很简单:
var src2qiniu = require('src2qiniu');
src2qiniu.init({
accessKey:'blabla',
secretKey:'blabla',
bucket:'your-bucket'
});
src2qiniu.transfer('https://www.npmjs.org/static/img/npm.png',function(err,imgUrl){
// imgUrl: http://{your-bucket}.qiniudn.com/{hash}
});