最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號安全,請及時綁定郵箱和手機立即綁定

最后一個輸出流的問題

我的代碼是這樣的,為什么執(zhí)行出來只輸出一個第一次push進去的內容啊


var stream = require('stream');
var util = require('util');

function ReadStream () {
?? ?stream.Readable.call(this);
}
util.inherits(ReadStream, stream.Readable);


ReadStream.prototype._read = function () {
?? ?this.push(' I');
?? ?this.push(' love');
?? ?this.push(' imooc,');
?? ?this.push(null);
};

function WriteStream () {
?? ?stream.Writable.call(this);
?? ?this._cached = new Buffer.from('');
}

util.inherits(WriteStream, stream.Writable);

WriteStream.prototype._write = function (chunk) {
?? ?console.log(chunk.toString());
};

function TransformStream () {
?? ?stream.Transform.call(this);
}

util.inherits(TransformStream, stream.Transform);

TransformStream.prototype._transform = function(chunk){
?? ?this.push(chunk);
};

TransformStream.prototype._flush = function(cb){
?? ?this.push('12345');
?? ?cb && cb();
};

var rs = new ReadStream();
var ws = new WriteStream();
var ts = new TransformStream();

rs.pipe(ts).pipe(ws);



正在回答

舉報

0/150
提交
取消
進擊Node.js基礎(二)
  • 參與學習       76723    人
  • 解答問題       242    個

本教程帶你攻破 Nodejs,讓 JavaScript流暢運行在服務器端

進入課程

最后一個輸出流的問題

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號