亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

stram pipe管道 代碼運行錯誤

stram pipe管道 代碼運行錯誤

木子水吉_1025 2017-03-06 15:30:46
var stream = require('stream');var util = require('util');//自定義可讀類的方法function ReadStream() { stream.Readable.call(this);? }//調用util.inherits(ReadStream, stream.Readable);//讓ReadStream繼承流里面可讀的原型stream.Readable//為ReadStream添加原型鏈上的read方法ReadStream.prototype._read = function() { this.push('lijie '); this.push('do not love'); this.push('you!');}function WritStream() { stream.Writable.call(this); this._cached = new Buffer('');}util.inherits(WritStream, stream.Writable);WritStream.prototype._write = function(chunk, encode, cb) { console.log(chunk.toString()); cb();}function TransformStream() { stream.Transform.call(this);}util.inherits(TransformStream, stream.Transform);TransformStream.prototype._transform = function(chunk, encode, cb) { this.push(chunk); cb();}TransformStream.prototype._flush = function(cb) { this.push('i have no chioce'); //為得到的數據增加定制的內容 cb();}var rs = new ReadStream();var ws = new WritStream();var ts = new TransformStream();rs.pipe(ts).pipe(ws); //通過管道實現數據的讀轉換和寫我這個代碼不曉得哪里寫錯了,運行結果總是不對,是這樣的,希望大神指教
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 1239 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

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

公眾號

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