{"name":"streamfilter","version":"3.0.0","description":"Filtering streams.","main":"src/index.js","metapak":{"configs":["main","readme","jsdocs","eslint","mocha","codeclimate","travis"],"data":{"files":"src/*.js tests/*.mocha.js","testsFiles":"tests/*.mocha.js"}},"scripts":{"changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","cli":"env NODE_ENV=${NODE_ENV:-cli}","cover":"nyc npm test && nyc report --reporter=html --reporter=text","coveralls":"nyc npm test && nyc report --reporter=text-lcov | coveralls && rm -rf ./coverage","cz":"env NODE_ENV=${NODE_ENV:-cli} git cz","doc":"echo \"# API\" > API.md; jsdoc2md src/*.js tests/*.mocha.js >> API.md && git add API.md","lint":"eslint src/*.js tests/*.mocha.js","metapak":"metapak","mocha":"mocha tests/*.mocha.js","precz":"npm t && npm run lint && npm run doc && npm run metapak -- -s","prettier":"prettier --write src/*.js tests/*.mocha.js","preversion":"npm t && npm run lint && npm run doc && npm run metapak -- -s","test":"npm run mocha","version":"npm run changelog && git add CHANGELOG.md"},"repository":{"type":"git","url":"git+ssh://git@github.com/nfroidure/streamfilter.git"},"keywords":["assert","deepEqual","neat"],"author":{"name":"Nicolas Froidure","email":"nicolas.froidure@insertafter.com","url":"http://insertafter.com/en/index.html"},"license":"MIT","bugs":{"url":"https://github.com/nfroidure/streamfilter/issues"},"homepage":"https://github.com/nfroidure/streamfilter","devDependencies":{"commitizen":"^3.0.4","conventional-changelog-cli":"^2.0.11","coveralls":"^3.0.2","cz-conventional-changelog":"^2.1.0","eslint":"^5.8.0","eslint-plugin-prettier":"^3.0.0","jsdoc-to-markdown":"^4.0.1","metapak":"^2.0.0","metapak-nfroidure":"^9.0.2","mocha":"^5.2.0","nyc":"^13.0.1","prettier":"^1.14.3","streamtest":"^1.2.4"},"dependencies":{"readable-stream":"^3.0.6"},"engines":{"node":">=8.12.0"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"contributors":[],"eslintConfig":{"extends":["eslint:recommended"],"parserOptions":{"sourceType":"script","modules":true},"env":{"es6":true,"node":true,"jest":true,"mocha":true},"plugins":["prettier"],"rules":{"prettier/prettier":"error"}},"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5","proseWrap":"always"},"greenkeeper":{"ignore":["commitizen","cz-conventional-changelog","conventional-changelog-cli","jsdoc-to-markdown","eslint","eslint-config-prettier","prettier","mocha","coveralls","nyc"]},"gitHead":"373da8fa746a054f501ab34bb9feba74da226a84","_id":"streamfilter@3.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.10.0","_npmUser":{"name":"nfroidure","email":"nicolas.froidure@insertafter.com"},"dist":{"integrity":"sha512-kvKNfXCmUyC8lAXSSHCIXBUlo/lhsLcCU/OmzACZYpRUdtKIH68xYhm/+HI15jFJYtNJGYtCgn2wmIiExY1VwA==","shasum":"8c61b08179a6c336c6efccc5df30861b7a9675e7","tarball":"http://registry-npm.ywwl.com/streamfilter/download/streamfilter-3.0.0.tgz","fileCount":5,"unpackedSize":17937,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5rTmCRA9TVsSAnZWagAApy4P/29tk9vZXKyB7t/WTqhW\nNI37/fLhKMCzCjDxb5EhFUz3dqYB49ED2jHCwwnBfzE8b0r/RaFv5m35rbvR\nbkUpJqbSwVtorYXM/pSvHg9u54PxCmYFGngRKdBZpk0JklltTfcdyKNc4Eqh\nm2JshIEit7ROh5hur1QKTibJUSxzEFPVMmGz2W4xchXd/0Vpo158O36VHzqy\nzpz4gZOPT/u7heA06Ksuv98x8c2PzhSMe7Ao5cO9rKlwxNQmQm/QbzBf3IDD\nCW8OogHiHN1tRbLs4TRssj5Jne6Mkn7+LPk3jp0NGKhxZcoLiNdG2YEwaHXi\nTBAhYvX9ZqCxoVTy0xPSYKt8Roz6gFfgRwoVDqYUVbgQI2v2dYyuPdaxkqrO\n9mnCdEC/pJtTY4G9WfKkia5ZAuwdbuMPJq1e97+FufIbXaOyyC0aUgMEhfn5\ne6nO0Uq5TjmB+V4T8rR9QYKKyiXae4/rHR6HsY8ogQJXpAPAduUiKhqTbpJ7\n+aeEkQXCMJNbwVkGXoKC+Rm0cp/GajEXWTm3OM0dr/pDg1zITg2aDRAuc53c\n/ri/NA3r5DUZ9p5U8P2GLH1qVf63BpO5ZnYuKrF2Ambwd/Mc/Oi5sBCEj7gt\n896SJa4mwVIsFxTsCwUgGwze8LmgDD3iu9kRxu9Jbd5UPIJfbQbiEvRz2LHF\nl1El\r\n=4Uq4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCOxx3y3JCbpxOIOavq0AuZFOtYJDjQwB2ew02AiYQ+6wIhAPG8p8ZzdadvGcpfCWXPcZge9z/sY6gHZ5LFqM4wET9w"}],"size":6064,"noattachment":false,"key":"/streamfilter/-/streamfilter-3.0.0.tgz"},"maintainers":[{"name":"nfroidure","email":"nfroidure@elitwork.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/streamfilter_3.0.0_1541846245766_0.06540921179176018"},"_hasShrinkwrap":false,"readme":"[//]: # ( )\n[//]: # (This file is automatically generated by a `metapak`)\n[//]: # (module. Do not change it  except between the)\n[//]: # (`content:start/end` flags, your changes would)\n[//]: # (be overridden.)\n[//]: # ( )\n# streamfilter\n> Filtering streams.\n\n[![Build status](https://secure.travis-ci.org/nfroidure/streamfilter.svg)](https://travis-ci.org/nfroidure/streamfilter)\n[![Coverage Status](https://coveralls.io/repos/nfroidure/streamfilter/badge.svg?branch=master)](https://coveralls.io/r/nfroidure/streamfilter?branch=master)\n[![NPM version](https://badge.fury.io/js/streamfilter.svg)](https://npmjs.org/package/streamfilter)\n[![Dependency Status](https://david-dm.org/nfroidure/streamfilter.svg)](https://david-dm.org/nfroidure/streamfilter)\n[![devDependency Status](https://david-dm.org/nfroidure/streamfilter/dev-status.svg)](https://david-dm.org/nfroidure/streamfilter#info=devDependencies)\n[![Dependency Status](https://dependencyci.com/github/nfroidure/streamfilter/badge)](https://dependencyci.com/github/nfroidure/streamfilter)\n[![Package Quality](http://npm.packagequality.com/shield/streamfilter.svg)](http://packagequality.com/#?package=streamfilter)\n[![Code Climate](https://codeclimate.com/github/nfroidure/streamfilter.svg)](https://codeclimate.com/github/nfroidure/streamfilter)\n\n\n[//]: # (::contents:start)\n\n`streamfilter` is a function based filter for streams inspired per gulp-filter\n but no limited to Gulp nor to objectMode streams.\n\n## Installation\n\nFirst, install `streamfilter` in your project:\n```sh\nnpm install --save streamfilter\n```\n\n## Getting started\n\nThere are 3 common usages:\n\n### Simple filter\n\n```js\nimport FilterStream from 'streamfilter';\n\nconst filter = new FilterStream((chunk, encoding, cb) => {\n  const mustBeFiltered = chunk.length() > 128;\n  if(mustBeFiltered) {\n    cb(true);\n    return;\n  }\n  cb(false);\n});\n\n// Print to stdout a filtered stdin\nprocess.stdin\n  .pipe(filter)\n  .pipe(process.stdout);\n```\n\n### Filter and restore\n\n```js\nimport FilterStream from 'streamfilter';\n\nconst filter = new FilterStream((chunk, encoding, cb) => {\n  const mustBeFiltered = chunk.length() > 128;\n  if(mustBeFiltered) {\n    cb(true);\n    return;\n  }\n  cb(false);\n}, {\n  restore: true\n});\n\n// Print accepted chunks in stdout\nfilter.pipe(process.stdout);\n\n// Print filtered one to stderr\nfilter.restore.pipe(process.stderr);\n```\n\n### Filter and restore as a passthrough stream\nLet's reach total hype!\n\n```js\nimport FilterStream from 'streamfilter';\nimport { Transform } from 'stream';\n\n// Filter values\nconst filter = new FilterStream((chunk, encoding, cb) => {\n  const mustBeFiltered = chunk.length() > 128;\n  if(mustBeFiltered) {\n    cb(true);\n    return;\n  }\n  cb(false);\n}, {\n  restore: true,\n  passthrough: true\n});\n\n// Uppercase strings\nconst mySuperTransformStream = new Transform({\n  transform: (chunk, encoding, cb) => cb(\n    null,\n    Buffer.from(\n      chunk.toString(encoding).toUpperCase(),\n      encoding,\n    ),\n  ),\n});\n\n// Pipe stdin\nprocess.stdin.pipe(filter)\n  // Edit kept chunks\n  .pipe(mySuperTransformStream)\n  // Restore filtered chunks\n  .pipe(filter.restore)\n  // and output!\n  .pipe(process.stdout)\n```\n\nNote that in this case, this is *your* responsibility to end the restore stream\n by piping in another stream or ending him manually.\n\n[//]: # (::contents:end)\n\n# API\n<a name=\"StreamFilter\"></a>\n\n## StreamFilter(filterCallback, options) ⇒ <code>Stream</code>\nFilter piped in streams according to the given `filterCallback` that takes the\n following arguments: `chunk` the actual chunk, `encoding` the chunk encoding,\n filterResultCallback` the function to call as the result of the filtering\nprocess with `true` in argument to filter her or `false` otherwise.\n\nOptions are passed in as is in the various stream instances spawned by this\n module. So, to use the objectMode, simply pass in the `options.objectMode`\n value set to `true`.\n\n**Kind**: global function  \n**Returns**: <code>Stream</code> - The filtering stream  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| filterCallback | <code>function</code> | Callback applying the filters |\n| options | <code>Object</code> | Filtering options |\n| options.passthrough | <code>boolean</code> | Set to `true`, this option change the restore stream nature from a readable  stream to a passthrough one, allowing you to reuse the filtered chunks in an  existing pipeline. |\n| options.restore | <code>boolean</code> | Set to `true`, this option create a readable stream allowing you to use the  filtered chunks elsewhere. The restore stream is exposed in the `FilterStream`  instance as a `restore` named property. |\n\n\n# Authors\n- [Nicolas Froidure](http://insertafter.com/en/index.html)\n\n# License\n[MIT](https://github.com/nfroidure/streamfilter/blob/master/LICENSE)\n","publish_time":1541846245945,"_cnpm_publish_time":1541846245945,"dist-tags":{"latest":"4.0.0"}}