patient-stream
A stream that can be piped to many destinations over several ticks, so long as you know in advance how many destinations you'll need. Why? Because sometimes it's a drag to wrap everything in Passthrough streams in the same tick.
Usage
Pause your input stream (important). Construct a Patient
with the number of destinations you expect to add. At your leisure, bearing in mind that you've now got backpressure on your input, add all your destinations. When you've added as many as your Patient
expects, the input will be resumed for you. The Patient
will emit end
when all its destinations have emitted finish
.
var fs = Request = Patient = ; var input = Request;input; // requiredvar out1 = 'kitten_copy1.jpg';var out2 = 'kitten_copy2.jpg'; tee; var tee = 2;input;tee; ;
API
PatientStream
is a passthrough stream, so it has the same API as a duplex stream.
License
ISC