You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
399 B
20 lines
399 B
5 years ago
|
module.exports = function (stream) {
|
||
|
var read, started = false
|
||
|
|
||
|
function consume (_read) {
|
||
|
if(!_read) throw new Error('must be passed a readable')
|
||
|
read = _read
|
||
|
if(started) stream(read)
|
||
|
}
|
||
|
|
||
|
consume.resolve =
|
||
|
consume.ready =
|
||
|
consume.start = function (_stream) {
|
||
|
started = true; stream = _stream || stream
|
||
|
if(read) stream(read)
|
||
|
return consume
|
||
|
}
|
||
|
|
||
|
return consume
|
||
|
}
|