{"_id":"through2-spy","_rev":"14-67d03053f0d57020b6bc3a7596ede5e2","name":"through2-spy","description":"A through2 wrapper to for simple stream.PassThrough spies.","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"through2-spy","version":"1.0.0","description":"A through2 wrapper to for simple stream.PassThrough spies.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-spy.git"},"keywords":["streams","through","through2","passthrough","spy"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-spy/issues"},"devDependencies":{"tape":"~1.0.4","tap":"~0.4.3","stream-spigot":"~2.0.0","concat-stream":"~1.0.0"},"dependencies":{"through2":"~0.1.0"},"_id":"through2-spy@1.0.0","dist":{"shasum":"6e2a507879966b3693e64e7e81af8810e9079705","tarball":"https://registry.npmjs.org/through2-spy/-/through2-spy-1.0.0.tgz","integrity":"sha512-h/vYl3lp1NCNvQljw+O7f00tXODRFKRDlJbb+T/aEeyJEhE/SRgn78TLYZWhvsPI0X/5fFA8oFpaPjEV1R8+/Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCA5vIAVx6LI4TYqhB1bIOJNrDm882+ocOp1Lnkq1RWIAIgZ5x4m+kGUoy4jl4DW1Ny91B8zfDbWlFbVaMBFwWb0rs="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}]},"1.0.1":{"name":"through2-spy","version":"1.0.1","description":"A through2 wrapper to for simple stream.PassThrough spies.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-spy.git"},"keywords":["streams","through","through2","passthrough","spy"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-spy/issues"},"devDependencies":{"tape":"~1.0.4","tap":"~0.4.3","stream-spigot":"~2.0.0","concat-stream":"~1.0.0"},"dependencies":{"through2":"~0.1.0"},"_id":"through2-spy@1.0.1","dist":{"shasum":"1d9dc6206927501cde51ae187c7504d52785ba09","tarball":"https://registry.npmjs.org/through2-spy/-/through2-spy-1.0.1.tgz","integrity":"sha512-n6atHUtP4lKZ8+GWOKXMS1hWhSy1OX/vGzsI9qosnCuZ9GSBF5seTQlaXXl0Sc0zw69oS3fZimgP5dvkoJYtOw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG/B7ESrzDr56EoJP5VRLwdZ+vxWQek86vRhFaCUfqnKAiEAi2v7gH92DIkFnIXPvCFDjuRIcnOJRW3YV8WNao/hHj4="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}]},"1.1.0":{"name":"through2-spy","version":"1.1.0","description":"A through2 wrapper to for simple stream.PassThrough spies.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-spy.git"},"keywords":["streams","through","through2","passthrough","spy"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-spy/issues"},"devDependencies":{"tape":"~1.0.4","tap":"~0.4.3","stream-spigot":"~2.0.0","concat-stream":"~1.0.0"},"dependencies":{"through2":"~0.2.2"},"_id":"through2-spy@1.1.0","dist":{"shasum":"6d25f208932c29a24376cd379b4ae77074740e22","tarball":"https://registry.npmjs.org/through2-spy/-/through2-spy-1.1.0.tgz","integrity":"sha512-U1rbcKGLZ4366qVmip3G23QXnHLQ4QXaxQrT49I9TNMtgon1DAQxXxT3nGETjvKcGOte2ONkPZYIp789LlH7+g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICkVMj+wp9ThTSqIgPoWzwcKZd41U9YnqhHVJoXiOATtAiBrorzrc6CqTWnkfwo/rhC8jkNlztGKRZQTuriBqtsLkQ=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}]},"1.1.1":{"name":"through2-spy","version":"1.1.1","description":"A through2 wrapper to for simple stream.PassThrough spies.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-spy.git"},"keywords":["streams","through","through2","passthrough","spy"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/through2-spy/issues"},"devDependencies":{"tape":"~2.4.0","tap":"~0.4.8","stream-spigot":"~3.0.3","terminus":"~1.0.9"},"dependencies":{"through2":"~0.4.1"},"homepage":"https://github.com/brycebaril/through2-spy","_id":"through2-spy@1.1.1","dist":{"shasum":"fe0746e41eb745d93556acb1bf75e7b5f6cf5840","tarball":"https://registry.npmjs.org/through2-spy/-/through2-spy-1.1.1.tgz","integrity":"sha512-3D0wTS3C3tkkdeuCvmYgHaWxot6fOn89Oj47RQaeZHBXkdGXoWunpOvRgsViskyPbJ3tKScJ5xK0x51N/OBr8g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAFL83chOqHaG8RYxiMsKZ3GhLWM3Yg+rtjhml/HEsLEAiAJ4IetBgKPYqUM46BFcUZdA+omjNjAbcQKRuvkcjzTeg=="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}]},"1.2.0":{"name":"through2-spy","version":"1.2.0","description":"A through2 wrapper to for simple stream.PassThrough spies.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"tap test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-spy.git"},"keywords":["streams","through","through2","passthrough","spy"],"author":{"name":"Bryce B. Baril"},"license":"MIT","jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"bugs":{"url":"https://github.com/brycebaril/through2-spy/issues"},"devDependencies":{"tape":"~2.13.3","tap":"~0.4.11","stream-spigot":"~3.0.4","terminus":"~1.0.10"},"dependencies":{"through2":"~0.5.1","xtend":"~3.0.0"},"homepage":"https://github.com/brycebaril/through2-spy","_id":"through2-spy@1.2.0","_shasum":"9c891ca9ca40e1e1e4cf31e1ac57f94cc9d248cb","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}],"dist":{"shasum":"9c891ca9ca40e1e1e4cf31e1ac57f94cc9d248cb","tarball":"https://registry.npmjs.org/through2-spy/-/through2-spy-1.2.0.tgz","integrity":"sha512-QJ/32YGXA8K/PlkT/7kJOfWZREdlwoCcdVOL/wZHhV0JQJlwUQeDi4QZrEUEAdIL6Kjb9BRdHHz65zg+rzFxuA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCW/PyBcKMfi9AQIJODaSjY9bmmEMSa5Z/D54X4u7Y1fwIgUeN3S9BW2XkwvspF4qYNtf1oS0VroD8rc5GAif9tvto="}]}},"2.0.0":{"name":"through2-spy","version":"2.0.0","description":"A through2 wrapper to for simple stream.PassThrough spies.","main":"index.js","directories":{"test":"test"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-spy.git"},"keywords":["streams","through","through2","passthrough","spy"],"author":{"name":"Bryce B. Baril"},"license":"MIT","jshintConfig":{"asi":true,"globalstrict":true,"validthis":true,"eqnull":true,"node":true,"loopfunc":true,"newcap":false,"eqeqeq":false},"bugs":{"url":"https://github.com/brycebaril/through2-spy/issues"},"devDependencies":{"tape":"~4.0.0","stream-spigot":"~3.0.5","terminus":"~1.0.12"},"dependencies":{"through2":"~2.0.0","xtend":"~4.0.0"},"homepage":"https://github.com/brycebaril/through2-spy","gitHead":"9779ae85c7d9d2c86f5aca88f7dec5bd3ff76959","_id":"through2-spy@2.0.0","_shasum":"9b884c3dff9abd8a091237f02c4f19199f3ff0a8","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}],"dist":{"shasum":"9b884c3dff9abd8a091237f02c4f19199f3ff0a8","tarball":"https://registry.npmjs.org/through2-spy/-/through2-spy-2.0.0.tgz","integrity":"sha512-z0u+JYkckgGGsHw3rWPG58ZOlSglafN/OLnM+uPFvpzrJY9zjGBVYBZ94aH92DBr9ONHqjGK86xCrmpOwzQ+sA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+B++wAIVxaSagPBSkLZtZ9BrzZVH+0f+lWhCN1sZIRQIgRgtWPGczklaXJ/DVkpVWrsD0eHrUZrSfiiWbl/9qwek="}]}}},"readme":"through2-spy\n============\n\n[![NPM](https://nodei.co/npm/through2-spy.png)](https://nodei.co/npm/through2-spy/)\n\nThis is a super thin wrapper around [through2](http://npm.im/through2) for creating simple stream.PassThrough spies.\n\nSaves you a tiny bit of boilerplate compared to `through2` for writing stream spies.\n\nNote you will **NOT** be able to do anything but spy and abort the stream pipeline. To do any filtering or transformations you should consider `through2` `through2-filter` or `through2-map`.\n\nPass a function to run as each chunk goes through your stream pipeline. Return an Error to abort the pipeline.\n\n```js\n\nvar spy = require(\"through2-spy\")\n\nvar count = 0\nvar countChunks = spy(function (chunk) {\n  count++\n})\n\n// vs. with through2:\nvar countChunks = through2(function (chunk, encoding, callback) {\n  count++\n  this.push(chunk)\n  return callback()\n})\n\n// Then use your spy:\nsource.pipe(countChunks).pipe(sink)\n\n// Additionally accepts `wantStrings` argument to conver buffers into strings\nvar nsaregex = /(open source)|(foss)|(node\\.js)/i\nvar prizm = spy({wantStrings: true}, function (str) {\n  var wiretap = str.match(nsaregex)\n  if (wiretap) this.emit(\"OMGTERRIST\", wiretap[0], str)\n})\n\nprizm.on(\"OMGTERRIST\", sendDrone(/* ... */))\n\ninternet.pipe(prizm).pipe(internet)\n\n// Return an Error to abort the pipeline\nvar Meter = spy.ctor({maxBytes: 1024, bytes: 0}, function (chunk) {\n  this.options.bytes += chunk.length\n  if (this.options.bytes >= this.options.maxBytes) return new Error(\"Over 1024 byte limit!\")\n})\n\nvar meter = new Meter()\n\n```\n\nAPI\n---\n\n`require(\"through2-spy\")([options], fn)`\n---\n\nCreate a `through2-spy` instance that will call `fn(chunk)` and then silently pass through data downstream.\n\n`require(\"through2-spy\").ctor([options], fn)`\n---\n\nCreate a `through2-spy` Type that can be instantiated via `new Type()` or `Type()` to create reusable spies.\n\n`require(\"through2-spy\").obj([options], fn)`\n---\n\nCreate a `through2-spy` that defaults to `objectMode = true`.\n\n`require(\"through2-spy\").objCtor([options], fn)`\n---\n\nCreate a `through2-spy` Type that defaults to `objectMode = true`.\n\nOptions\n-------\n\n  * wantStrings: Automatically call chunk.toString() for the super lazy.\n  * all other through2 options\n\nLICENSE\n=======\n\nMIT\n","maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}],"time":{"modified":"2022-06-27T06:25:02.777Z","created":"2013-08-07T05:17:12.061Z","1.0.0":"2013-08-07T05:17:13.972Z","1.0.1":"2013-08-07T06:31:12.919Z","1.1.0":"2013-09-20T17:51:29.208Z","1.1.1":"2014-01-31T01:13:11.510Z","1.2.0":"2014-06-20T22:29:08.495Z","2.0.0":"2015-06-17T06:47:52.786Z"},"author":{"name":"Bryce B. Baril"},"repository":{"type":"git","url":"git@github.com:brycebaril/through2-spy.git"},"readmeFilename":"README.md","homepage":"https://github.com/brycebaril/through2-spy","keywords":["streams","through","through2","passthrough","spy"],"bugs":{"url":"https://github.com/brycebaril/through2-spy/issues"},"license":"MIT","users":{"bret":true}}