Skip to content

Repository files navigation

Purrfect Matcher

Purrfect Matcher is a powerful and efficient multi-threaded text matching tool for finding keyword occurrences in large files.

Features

  • Reads large files in chunks to handle memory efficiently.
  • Uses multiple threads to process chunks in parallel.
  • Supports case-insensitive matching.
  • Outputs results in JSON format or a human-readable format.
  • Optionally prints execution time.

Installation

To install the dependencies, run:

npm install

Usage

To run the Purrfect Matcher, use the following command:

npm run start -- <input-file> [options]

This command should be run in the root directory of the project after building the project with npm run build.

Alternatively you can use ts-node to run the project without building:

npx ts-node src/main.ts <input-file> [options]

Command Line Arguments

  • input (required): Path to the input file.
  • --output (optional): Path to the output file. If not specified, the results will be printed to the console.
  • --threads (optional): Number of threads to use (default: number of CPUs).
  • --ignore-case (optional): Case insensitive matching.
  • --time (optional): Print execution time.
  • --json (optional): Output results in JSON format.

Example

npm run start -- input.txt --output results.txt --threads 4 --ignore-case --time --json

Test File

You can download test file from https://norvig.com/big.txt by running the following command.

curl https://norvig.com/big.txt > big.txt

License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

A high-performance, multi-threaded text pattern matcher for large files

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages