GitXplorerGitXplorer
k

node-text-stream-search

public
6 stars
1 forks
2 issues

Commits

List of commits on branch main.
Verified
022fe7127ae8e5b77e8b5a42bca002e04cb2f6da

Bump http-cache-semantics from 4.1.0 to 4.1.1 (#135)

ddependabot[bot] committed 2 years ago
Verified
976e4e5f4d65e97143e758114eb35737edd40723

Bump json5 from 1.0.1 to 1.0.2 (#134)

ddependabot[bot] committed 2 years ago
Verified
b7cf87d438577326591f89e6b00bbef1fd175a83

v5.0.0

kkevgo committed 2 years ago
Verified
7331317b902937c4a3403e6e25e70762e70ea2c8

Default export (#133)

kkevgo committed 2 years ago
Verified
fdd5ffc5de4fc80d9dc03e7447ab26ad10e74303

Remove obsolete Text-Runner custom action

kkevgo committed 2 years ago
Verified
d494ca790f2a119b19a4f86f7ae277f662047770

Silence Yarn version output (#131)

kkevgo committed 2 years ago

README

The README file for this repository.

Text Search in Node.JS Streams

tests Code Coverage 0 dependencies install size Language grade: JavaScript

This micro-library (no dependencies) searches for occurrences of a given search term (string or Regex) in a Node.js stream, i.e. anything that emits data events with Buffers or strings.

import TextStreamSearch from "text-stream-search"

const streamSearch = new TextStreamSearch(myStream)

// wait until myStream contains "hello"
await streamSearch.waitForText("hello")

// capture data from the stream
const matchText = await streamSearch.waitForRegex("listening at port \\d+.")
// matchingText contains something like "listening at port 3000."

// access the captured stream content
const text = streamSearch.fullText()

For a working example see the end-to-end test.

Related projects

  • StreamSnitch: does the same thing with regular expressions, but is buggy and blocks the event queue

Development

Please submit bugs, ideas, or improvements via an issue or pull request.

  • run all tests: make test
  • run unit tests: make unit
  • run linters: make lint
  • fix formatting issues: make lint
  • see all available make commands: make help

Deploy a new version

  • update the version in package.json and commit to main
  • run npm publish