/ ai-anxieties-audio / node_modules / streamsearch /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]test/a year ago -  
[DIR]lib/a year ago -  
[   ]package.jsona year ago842 120707f added node version q18.16 to dependincies [كارل مبارك]
[TXT]README.mda year ago2.6K15de0e0 styling, texts [كارل مبارك]
[   ]LICENSEa year ago1.1Kf0d2fc9 test post-receive hook [كارل مبارك]
README.md

Description

streamsearch is a module for node.js that allows searching a stream using the Boyer-Moore-Horspool algorithm.

This module is based heavily on the Streaming Boyer-Moore-Horspool C++ implementation by Hongli Lai here.

Requirements

Installation

npm install streamsearch

Example

  const { inspect } = require('util');

  const StreamSearch = require('streamsearch');

  const needle = Buffer.from('\r\n');
  const ss = new StreamSearch(needle, (isMatch, data, start, end) => {
    if (data)
      console.log('data: ' + inspect(data.toString('latin1', start, end)));
    if (isMatch)
      console.log('match!');
  });

  const chunks = [
    'foo',
    ' bar',
    '\r',
    '\n',
    'baz, hello\r',
    '\n world.',
    '\r\n Node.JS rules!!\r\n\r\n',
  ];
  for (const chunk of chunks)
    ss.push(Buffer.from(chunk));

  // output:
  //
  // data: 'foo'
  // data: ' bar'
  // match!
  // data: 'baz, hello'
  // match!
  // data: ' world.'
  // match!
  // data: ' Node.JS rules!!'
  // match!
  // data: ''
  // match!

API

Properties

Functions

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80