linx-simulator2/node_modules/drop-stream
2019-11-22 09:43:37 +00:00
..
index.js Simulator first commit 2019-09-18 11:11:16 +03:00
package.json Added custom log name 2019-11-22 09:43:37 +00:00
README.md Simulator first commit 2019-09-18 11:11:16 +03:00

drop-stream Dependencies Status Image Build Status Image Coverage Status

A Duplex stream which discards all chunks passed through.

Usage

Install using:

npm install drop-stream --save

Then pipe through a drop instance:

var DropStream = require('drop-stream'),
    PassThrough = require('stream').PassThrough,
    opts = {objectMode: true},
    pre = new PassThrough(opts),
    drop = DropStream.obj(),
    post = new PassThrough(opts),
    count = 0;

post.on('data', function() {
  count++;
});

post.on('finish', function() {
  assert.strictEqual(count, 0, count + ' chunks detected'); // won't throw
});

pre.pipe(drop).pipe(post);

pre.write('foo');
pre.write(1);
pre.write({ foobar: 'foobar', answer: 42 });
pre.write('bar');
pre.end();

API

Class: DropStream

Drop streams are Transform streams.

new DropStream([options])

Note: The new operator can be omitted

DropStream#obj([options])

A convenience wrapper for new DropStream({objectMode: true, ...}).

License

Copyright (c) 2014 Michael Mayer

Licensed under the MIT license.