{"dist":{"shasum":"5350ebc548378da45f3727aefebac3aec5dcc345","tarball":"https://registry.npmjs.org/streamsearch/-/streamsearch-0.0.1.tgz","integrity":"sha512-l+XPdaQqIZo9By5FZFnK8OskgaU+j7x6Ia5DQOo+407ywlA0Cem1/jFU/sTx68bBn+YTZEpqtC5M2wmbLFFaIA==","signatures":[{"sig":"MEUCIEy3XvyxBkmRq/MN7km3hqKk48oSXo8SRUi/9DvjiqkkAiEAlgOHQaymojRR2IjTaLxnbGmyVErcC/HzTFfde8235yo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./sbmh","name":"streamsearch","author":{"name":"Brian White","email":"mscdex@mscdex.net"},"readme":"Description\n===========\n\nstreamsearch is a module for [node.js](http://nodejs.org/) that allows searching a stream using the Boyer-Moore-Horspool algorithm.\n\nThis module is based heavily on the Streaming Boyer-Moore-Horspool C++ implementation by Hongli Lai [here](https://github.com/FooBarWidget/boyer-moore-horspool).\n\n\nRequirements\n============\n\n* [node.js](http://nodejs.org/) -- v0.8.0 or newer\n\n\nInstallation\n============\n\n    npm install streamsearch\n\nExample\n=======\n\n```javascript\n  var StreamSearch = require('streamsearch'),\n      inspect = require('util').inspect;\n\n  var needle = new Buffer([13, 10]), // CRLF\n      s = new StreamSearch(needle),\n      chunks = [\n        new Buffer('foo'),\n        new Buffer(' bar'),\n        new Buffer('\\r'),\n        new Buffer('\\n'),\n        new Buffer('baz, hello\\r'),\n        new Buffer('\\n world.'),\n        new Buffer('\\r\\n Node.JS rules!!\\r\\n\\r\\n')\n      ];\n  s.on('data', function(data, start, end) {\n    console.log('data: ' + inspect(data.toString('ascii', start, end)));\n  });\n  s.on('match', function() {\n    console.log('match!');\n  });\n  for (var i = 0, len = chunks.length; i < len; ++i)\n    s.push(chunks[i]);\n\n  // output:\n  //\n  // data: 'foo'\n  // data: ' bar'\n  // match!\n  // data: 'baz, hello'\n  // match!\n  // data: ' world.'\n  // match!\n  // data: ' Node.JS rules!!'\n  // match!\n  // data: ''\n  // match!\n```\n\n\nAPI\n===\n\nEvents\n------\n\n* **data**(< _Buffer_ >chunk, < _integer_ >start, < _integer_ >end) - Emitted when non-needle data is available. This data is in `chunk` between `start` (inclusive) and `end` (exclusive).\n\n* **match**() - Emitted when the needle has been found in the stream.\n\n\nProperties\n----------\n\n* **maxMatches** - < _integer_ > - The maximum number of matches. This is especially useful when multiple matches exist within a single chunk passed to push(), so that this module knows to stop matching within that single chunk. Defaults to Infinity.\n\n* **matches** - < _integer_ > - The current match count.\n\n\nFunctions\n---------\n\n* **(constructor)**(< _Buffer_ >needle) - Creates and returns a new instance for searching for `needle`.\n\n* **push**(< _Buffer_ >chunk) - _integer_ - Process `chunk`. The return value is the last processed index in `chunk` + 1.\n\n* **reset**() - _(void)_ - Resets internal state. Useful for when you wish to start searching a new/different stream for example.\n","engines":{"node":">=0.8.0"},"scripts":{},"_npmUser":{"name":"mscdex","email":"mscdex@mscdex.net"},"keywords":["stream","horspool","boyer-moore-horspool","boyer-moore","search"],"licenses":[{"url":"http://github.com/mscdex/streamsearch/raw/master/LICENSE","type":"MIT"}],"repository":{"url":"http://github.com/mscdex/streamsearch.git","type":"git"},"_npmVersion":"1.1.66","description":"Streaming Boyer-Moore-Horspool searching for node.js","directories":{},"maintainers":[{"name":"mscdex","email":"mscdex@mscdex.net"}],"readmeFilename":"README.md","_id":"streamsearch@0.0.1","version":"0.0.1"}