# 通过 #
简单的方式创建 Stream 这都是 readable 财务报告和审定财务报表 writable。 。 。 .
- 可选通过
write财务报告和审定财务报表end方法。 。 . through使用时注意暂停/恢复逻辑this.queue(data)改为this.emit('data', data)。 。 。 .- 使用
this.pause()财务报告和审定财务报表this.resume()管理流量. - 检查
this.paused以查看当前流状态。 ()write总是返回!this.paused) (中文(简体) ).
此函数是大多数同步流的基础 事件流。 。 。 .
var through = require('through')
through(function write(data) {
this.queue(data) //data *must* not be null
},
function end () { //optional
this.queue(null)
})
或者,也可以用来 无 暂停时缓冲, 使用 this.emit('data', data), (中文(简体) ),
和此. emit( 'end' )
var through = require('through')
through(function write(data) {
this.emit('data', data)
//this.pause()
},
function end () { //optional
this.emit('end')
})
扩展选项
你可能不需要99%的时间.
自动销毁=虚假
默认, through 当可写入时, 将关闭
和可读的一面 溪流已经结束.
如果不希望这样做,设置 autoDestroy=false。 。 。 .
var through = require('through')
//like this
var ts = through(write, end, {autoDestroy: false})
//or like this
var ts = through(write, end)
ts.autoDestroy = false
许可证
麻省理工学院/Apache2

