/fs-find

Flexible search of file content

Primary LanguageJavaScriptMIT LicenseMIT

fs-find

Flexible search of file content

Hits-of-Code CI Code QL codecov

const {core} = require('@zkud/fs-find');
const {Searcher, Query} = core;

const searcher = new Searcher();
const results = await searcher.search(
    new Query()
        .from('./src/')
        .filterBy(({path}) => path.endsWith('.js'))
        .mapAs((content) => content.match(/class/g))
        .reduceAs((a, b) => a.concat(b), []),
);

// -> ['class', 'class', ...]
console.log(results);

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 16.* or higher is required.

If this is a brand new project, make sure to create a package.json first with the npm init command.

Installation is done using the npm install command:

$ npm install @zkud/fs-find

Features

  • Performant cached FILTER-MAP-REDUCE read-only queries to a file system
  • Super-high test coverage
  • High flexibility to use your own file systems / specific searches

Docs & Community

Security Issues

If you discover a security vulnerability, please see Security Policies and Procedures.

License

MIT