stream-expect is a tool for controlling interactive streams.
$ npm install stream-expect
Checkout the examples for some sample usage.
Returns a new Expect object.
ReadStream- Object - A readable stream
WriteStream- Object - A writeable stream
Similar to above, but stream is both readable and writeable.
Convenience method for spawning a process, creating an Expect object, and using stdin and stdout for the read and write streams.
In other words this:
var child =var exp = expect
Could optionally be replaced with this:
var exp = expect
Watch stream for data matching regex. Here are the callback's arguments:
err- Error|null - An error object will be returned if expect times out
output- String - The output of the stream since method was called
match- Array - The results of the successful regex
It's worth noting that regex matches will be non-greedy.
Write to the writeable stream