1.1.0 • Published 2 years ago

@start-software/node-grep v1.1.0

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

node-grep

Grep style file searching

Installation

npm i @start-software/node-grep

Usage

The following code searches all files in the test-files for an array of search values.

const path = require('path');
const { searchInFiles } = require('@start-software/node-grep');

const testSearch = async () => {
    const dir = path.join(__dirname, 'test-files');
    const searchText = 'Tom';
    const result = await searchInFiles(dir, searchText);
    return result;
};

testSearch().then(result => console.log(result));

Output

['file1.txt', 'file3.txt', 'file5.docx'];

Supported files types

  • All text files
  • PDFs
  • Word documents (.doc and .docx)