New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

find-file-extra

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-file-extra

Simple file finder with both file name and content search options

  • 1.0.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Simple (with advanced feature) file search

Examples

File name search

// Find all json files (and load content + parse to json)
let jsonFiles = await findFileExtra({
  root: MY_PROJECT_ROOT,
  filePattern: "**/*.json",
  loadFileContent: true,
  parseJson: true,
});

File name and content search

// Find all json files (and load content + parse to json)
let files = await findFileExtra({
  root: MY_PROJECT_ROOT,
  filePattern: "**/*.ts",
  fileContentPattern: "search-me",
  loadFileContent: true,
});

File name and content search (regexp)

// Find all json files (and load content + parse to json)
let files = await findFileExtra({
  root: MY_PROJECT_ROOT,
  filePattern: "**/*.ts",
  fileContentPattern: /search\-me|searchMe/,
  loadFileContent: true,
});

Options

OptionRequiredTypeDefaultDescription
roottruestring-Root directory to search in.
filePatternfalsestringundefinedFile pattern to search for. (glob pattern)[https://en.wikipedia.org/wiki/Glob_(programming)]
ignoreFilePatternfalsestringundefinedFile pattern to ignore. (glob pattern)[https://en.wikipedia.org/wiki/Glob_(programming)]
fileContentPatternfalseregexp / stringundefinedFile content pattern to search for.
loadFileContentfalsebooleanfalseLoad file content.
parseJsonfalsebooleanfalseParse file content to json.
dotfalsebooleantrueUse dot notation for json keys.
nocasefalsebooleantrueCase insensitive search.

parseJson requires loadFileContent to be true.

if filePattern and fileContentPattern is both undefined (not set) all files will found.

Installation

  • npm install find-files-extra
  • yarn add find-files-extra

Keywords

FAQs

Package last updated on 03 Dec 2021

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