1.0.1 • Published 1 year ago

line-reader-regex v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

line-reader-regex

A Node.js package to read a file line by line and extract lines based on a regex match. By default, It returns every line.

Installation

Install my-project with npm

  npm install line-reader-regex

Usage/Examples

const readLinesWithRegex = require('line-reader-regex');

const filePath = 'path/to/your/large/file.txt';
const regex = /your-regex/;

// Without async-await (.then() chaining)
readLinesWithRegex(filePath, regex)
  .then((lines) => {
    console.log("Matching lines:", lines);
  })
  .catch((err) => {
    console.error("Error reading file:", err);
  });

// With async-await
const readFileAsync = async () => {
  const data = await readLinesWithRegex(filePath, regex);
  console.log("🚀 data:", data);
};

Feedback

If you have any feedback, please reach out to me at jarvisfranklinthaker@gmail.com

Authors

1.0.1

1 year ago

1.0.0

1 year ago