Bytes go in, but they don't come out (when muted).
This is a basic pass-through stream, but when muted, the bytes are silently dropped, rather than being passed through.
var MuteStream =var ms = optionsmsms // writes 'foo' to stdoutmsms // does not write 'bar'msms // writes 'baz' to stdout// can also be used to mute incoming datavar ms =inputmsinput // logs 'foo'msinput // does not log 'bar'msinput // logs 'baz'
All options are optional.
replaceSet to a string to replace each character with the specified string when muted. (So you can show
****instead of the password, for example.)
promptIf you are using a replacement char, and also using a prompt with a readline stream (as for a
Password: *****input), then specify what the prompt is so that backspace will work properly. Otherwise, pressing backspace will overwrite the prompt with the replacement character, which is weird.
.write() into a no-op.
True if the pipe destination is a TTY, or if the incoming pipe source is a TTY.
Other stream methods...
The other standard readable and writable stream methods are all available. The MuteStream object acts as a facade to its pipe source and destination.