sfcode
An Online Competing and Development Environment
|
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.
All options are optional.
replace
Set to a string to replace each character with the specified string when muted. (So you can show ****
instead of the password, for example.)prompt
If 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.Set muted
to true
. Turns .write()
into a no-op.
Set muted
to false
True if the pipe destination is a TTY, or if the incoming pipe source is a TTY.
The other standard readable and writable stream methods are all available. The MuteStream object acts as a facade to its pipe source and destination.