5.0.0 • Published 2 years ago

text-stream-search v5.0.0

Weekly downloads
622
License
ISC
Repository
github
Last release
2 years ago

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
5.0.0

2 years ago

4.0.3

4 years ago

4.0.2

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.1.4

5 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.2.5

6 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago