Have ideas to improve npm?Join in the discussion! »

    noop-stream
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.0 • Public • Published

    noop-stream Build Status

    Create a readable Node.js stream that produces no data (or optionally blank data) or a writable stream that discards data

    This can be useful for testing, fixtures, draining a stream, etc.

    It's like /dev/null but cross-platform.

    Install

    $ npm install noop-stream
    

    Usage

    const stream = require('stream');
    const {readableNoopStream} = require('noop-stream');
     
    stream.pipeline(readableNoopStream({size: 10}), process.stdout);
    const stream = require('stream');
    const {writableNoopStream} = require('noop-stream');
     
    stream.pipeline(process.stdin, writableNoopStream());

    API

    readableNoopStream(options?)

    Create a readable Node.js stream that produces no data (or optionally blank data).

    Options are passed to the stream.Readable constructor, except for the read option.

    You can also specify a size option, which is the size in bytes to produce. By default, it's 0. Set it to Infinity to make it produce data until you manually destroy the stream.

    writableNoopStream(options?)

    Create a writable Node.js stream that discards received data.

    Options are passed to the stream.Writable constructor, except for the write option.

    Related

    Install

    npm i noop-stream

    DownloadsWeekly Downloads

    1,354

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    5.77 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar