Intercept
A stream proxy utility.
Setup
const intercept = ; var unhook = intercept;intercept; //all data are gathered by default in the _data property of the intercepted streamintercept; //_datar ; //release stdout hook//process._stderr();
Note that all process streams are intercepted by default upon loading of the module! If you attempt to intercept more than once this will break the flow of the _data holder. Process stream hooks are found in process._stdout, process._stderr etc, so you can unbound them upon loading...
This module comes with an extra feature. All intercepted writable streams now emit a
data
event with the data to-be-written, this way you don't have to unhook the builtin TTY streams to grab data in a custom function, BUT, one of the features of this module is that the data-to-be written can be alternated by returning a string from the callback, this wont work for events...