猿问

fs.createWriteStream如何知道已经完成了呢?

原谅我这个伸手党,完全是头大了。

上代码:


var qr_image = require('qr-image');  

var images = require('images');

var request = require('request');

var fs = require('fs');


var logo = request('http:/\/wx.qlogo.cn\/mmopen\/PiajxSqBRaEKqqa31ybC79PqVmErpI2QiapLA5yxT9ampXSa1WrDxcTc6AokhZpBBoOvDYFwTJ5aP6Gvtarcib70w\/64')

.pipe(fs.createWriteStream('logo.jpeg'));

var qr = qr_image.imageSync('http://weixin.qq.com/q/027920JGB8eZ010000M07Q');

var width = images(qr).width() /2 ;

var height = images(qr).height() /2;

var size = width/2;


//images(qr).draw(images('logo.jpeg').size(size),width-size/2,height-size/2).save('t11est.jpeg',{quality:50});

我想等logo写入完成后执行注释的代码。请问如何写?

谢谢大神?


凤凰求蛊
浏览 1061回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答