basant307/AI_Governance_Project
045
1# mute-stream2 3Bytes go in, but they don't come out (when muted).4 5This is a basic pass-through stream, but when muted, the bytes are6silently dropped, rather than being passed through.7 8## Usage9 10```javascript11const MuteStream = require('mute-stream')12 13const ms = new MuteStream(options)14 15ms.pipe(process.stdout)16ms.write('foo') // writes 'foo' to stdout17ms.mute()18ms.write('bar') // does not write 'bar'19ms.unmute()20ms.write('baz') // writes 'baz' to stdout21 22// can also be used to mute incoming data23const ms = new MuteStream()24input.pipe(ms)25 26ms.on('data', function (c) {27 console.log('data: ' + c)28})29 30input.emit('data', 'foo') // logs 'foo'31ms.mute()32input.emit('data', 'bar') // does not log 'bar'33ms.unmute()34input.emit('data', 'baz') // logs 'baz'35```36 37## Options38 39All options are optional.40 41* `replace` Set to a string to replace each character with the42 specified string when muted. (So you can show `****` instead of the43 password, for example.)44 45* `prompt` If you are using a replacement char, and also using a46 prompt with a readline stream (as for a `Password: *****` input),47 then specify what the prompt is so that backspace will work48 properly. Otherwise, pressing backspace will overwrite the prompt49 with the replacement character, which is weird.50 51## ms.mute()52 53Set `muted` to `true`. Turns `.write()` into a no-op.54 55## ms.unmute()56 57Set `muted` to `false`58 59## ms.isTTY60 61True if the pipe destination is a TTY, or if the incoming pipe source is62a TTY.63 64## Other stream methods...65 66The other standard readable and writable stream methods are all67available. The MuteStream object acts as a facade to its pipe source68and destination.69 