Server IP : 85.214.239.14 / Your IP : 18.227.183.235 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/task/3/root/proc/3/root/lib/node_modules/pm2/node_modules/mute-stream/ |
Upload File : |
# mute-stream 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. ## Usage ```javascript var MuteStream = require('mute-stream') var ms = new MuteStream(options) ms.pipe(process.stdout) ms.write('foo') // writes 'foo' to stdout ms.mute() ms.write('bar') // does not write 'bar' ms.unmute() ms.write('baz') // writes 'baz' to stdout // can also be used to mute incoming data var ms = new MuteStream input.pipe(ms) ms.on('data', function (c) { console.log('data: ' + c) }) input.emit('data', 'foo') // logs 'foo' ms.mute() input.emit('data', 'bar') // does not log 'bar' ms.unmute() input.emit('data', 'baz') // logs 'baz' ``` ## Options 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. ## ms.mute() Set `muted` to `true`. Turns `.write()` into a no-op. ## ms.unmute() Set `muted` to `false` ## ms.isTTY 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.