Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tiny-fsearch

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-fsearch

A small and versatile find-in-file/search library.

  • 2.0.0
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

tiny-fsearch

Fast and Simple File Search for NodeJS. Versatile find-in-files/search methods that can take in a range of options.

Getting Started

tiny-fsearch is a native Node module available via NPM. It can be installed with.

$ npm install --save tiny-fsearch

Usage

The module consists of two available functions and a promisified alternative.

const fsearch = require('tiny-fsearch');

/// Single-threaded query (returns all found matches).
fsearch.sync(source, predicate, options);

/// Multi-threaded query stream (returns an async iterator).
fsearch.stream(source, predicate, options);

/// Wraps `stream` in a promise wrapper for results.
fsearch.concurrent(source, predicate, options);

Options

source [string]

A file or directory in which to search in.

predicate [string|RegExp]

The string or RegExp to use for matching.

options [fsearch.IOptions]

The available options exposed for setting different search parameters are:

interface fsearch.IOptions {
    exclude: string[];          // File-globs to exclude from searching         (default: [])
    ignoreCase: boolean;        // Run a case-insensitive match                 (default: true)
    matchWholeWord: boolean;    // Wraps searches in a word-group boundary      (default: false)
}

Results

Matched results with be in the form of:

interface fsearch.IMatch {
    readonly line: number;
    readonly column: number;
    readonly length: number;
    readonly filePath: number;
}

License

MIT

FAQs

Package last updated on 24 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc