2.0.0 • Published 2 months ago

mute-stream v2.0.0

Weekly downloads
19,791,069
License
ISC
Repository
github
Last release
2 months ago

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

const MuteStream = require('mute-stream')

const 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
const 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.

inquirerreadreadline2@huyhpham/rn-linearchetype-libraryeasy-select-rnreact-native-bluetooth2killi8n-react-native-fast-imagepipihomern-send-smscad-cli@icanpm/api-master@arisageha/react-lazyload@arisageha/react-lazyload-fix@oneplanetcrowd/developersrdclr-boilerplate@cashremit/cr-streamline-icons@almeidaa/msreact-native-template-rfbase@nyadam/oraairscanairscan-examplebb-chatreact-native-esc-pos-sahaab@borisovart/atol-kkt-module@frxf/frxfdeneme323112@steven-torres/jsxr@texttree/demo-bsa-reference-rcl@ntt_app/react-native-custom-notificationreact-native-covid-sdkgql_din_modreact-native-thanh-toast-librarymutasi-bcamy-patches-inquirer@thanhnguyen14797/react-native-thanh-toast-library@jackub/inquirerauto-extractcthpb-plugin-socialmysql-formatreact-native-printer-brothersrn-pdf-reader-offline@steggy/google@steggy/home-cliintuireqreact-native-shekhar-bridge-testread2cogoportutilsukor-remasterdyx-reacttalent-to-vite-cli@oiti/documentoscopy-react-native@respondea/cordova-plugin-v-inappbrowser@mink-opn/build-tokensquoc-testreact-native-slider-kftcgittc-git-directionunblock-block-save-variables@infinitebrahmanuniverse/nolb-mut@prodam/prodam-typesshamsi-date-nowexpand-react-bridgeluminos-ui-core@everything-registry/sub-chunk-2221iqra-calculatorjawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgp149-table@digital-alchemy/config-builder@digital-alchemy/hass-cli@digital-alchemy/sampler-app@digital-alchemy/tty@synctree/libijsreact-native-jawwy_samplecode-msi-simple_calculator123zs89cli-number-guessingkny63-atm-machinekshahmeer10_atmatm_process@uf3sindh/simple_cli_calculatorhmmmmd12-cli-number-guessinghmd12-cli-number-guessingja--simple--calculatorcode-with-zafar-number-gusseing-gamecode-with-zafar-student-managment-systemgriffin-ui-librarynadia-simple-calculatoratm-code-from-inquirer-code-with-hasnainatm-code-with-hasnainatm-code-with-hasnain-using-inquirercode-with-abbasi-riffattalha12-todo-listtanngotdl1-to-do-listsyz432cli-number-guessing
2.0.0

2 months ago

1.0.0

2 years ago

0.0.8

6 years ago

0.0.7

8 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

11 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago