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

chunkmatcher

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chunkmatcher

Fast searching for multiple patterns accross multiple data chunks.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

chunkmatcher

Fast searching for multiple patterns accross multiple data chunks.

This is useful if you have an http request that you want to search for terms and you don't want to buffer the whole response or test boundary conditions for terms between chunks.

Installation

$ npm install chunksearch

Quick Examples

var Terms = require("chunkmatcher").Terms;

var terms = new Terms();
terms.add('test', { ignoreCase: true });
terms.add('testing');
terms.add('search');

var matcher = terms.createMatcher();
matcher.append('test sear');
matcher.append('ching t te tes te');
matcher.append('sting test');
console.log(matcher.results);
// [
//   {
//     start: 0,
//     pattern: 'test'
//   },
//   {
//     start: 5,
//     pattern: 'search'
//   },
//   {
//     start: 24,
//     pattern: 'test'
//   },
//   {
//     start: 24,
//     pattern: 'testing'
//   },
//   {
//     start: 32,
//     pattern: 'test'
//   }
// ]
var Terms = require("chunkmatcher").Terms;

var terms = new Terms();
terms.add('www.google.com');
var matcher = terms.createMatcher();

var options = {
  host: 'www.google.com',
  port: 80,
  path: '/index.html'
};
http.get(options, function (res) {
  res.on('data', function (chunk) {
    matcher.append(chunk);
  });
  res.on('end', function () {
    console.log(matcher.results);
  });
});

Keywords

FAQs

Package last updated on 22 Jun 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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