Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

streamfilter

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

streamfilter - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

8

package.json
{
"name": "streamfilter",
"version": "1.0.1",
"version": "1.0.2",
"description": "Filtering streams.",

@@ -29,8 +29,8 @@ "main": "src/index.js",

"istanbul": "^0.3.5",
"mocha": "^2.1.0"
"mocha": "^2.1.0",
"streamtest": "^1.0.0"
},
"dependencies": {
"readable-stream": "^1.0.33",
"streamtest": "^1.0.0"
"readable-stream": "^1.0.33"
}
}

@@ -24,3 +24,3 @@ var stream = require('readable-stream');

this._restoreStreamCallback = null;
this._transform = function(chunk, encoding, done) {

@@ -70,2 +70,1 @@ filterCallback(chunk, encoding, function StreamFilterCallback(filter) {

module.exports = StreamFilter;
var assert = require('assert');
var Stream = require('stream');
var StreamTest = require('streamtest');

@@ -16,3 +17,3 @@ var StreamFilter = require('../src/index');

});
// Iterating through versions

@@ -77,3 +78,3 @@ StreamTest.versions.forEach(function(version) {

it('with restore and passthrough option', function(done) {
it('with restore and passthrough option in a differrent pipeline', function(done) {
var inputStream = StreamTest[version].fromObjects([object1, object2]);

@@ -108,2 +109,35 @@ var filter = new StreamFilter(function(chunk, encoding, cb) {

it('with restore and passthrough option in the same pipeline', function(done) {
var passThroughStreamEnded = false;
var inputStream = StreamTest[version].fromObjects([object1, object2]);
var filter = new StreamFilter(function(chunk, encoding, cb) {
if(chunk === object2) {
return cb(true);
}
return cb(false);
}, {
objectMode: true,
restore: true,
passthrough: true
});
var outputStream = StreamTest[version].toObjects(function(err, objs) {
if(err) {
return done(err);
}
assert.deepEqual(objs, [object1, object2]);
done();
});
inputStream.pipe(filter)
.pipe(new Stream.PassThrough({ objectMode: true }))
.on('end', function() {
passThroughStreamEnded = true;
})
.pipe(filter.restore)
.on('end', function() {
assert(passThroughStreamEnded,
'PassThrough stream ends before the restore one.');
})
.pipe(outputStream);
});
});

@@ -202,2 +236,1 @@

});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc