"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/mute-stream/README.md" (17 Oct 2016, 1653 Bytes) of archive /windows/misc/atom-windows.zip:

As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.


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.


```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 © { 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’ ```


All options are optional.


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.

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.