Skip to content

Searches for a specified file type in a given directory or directories and returns an array of file paths

License

Notifications You must be signed in to change notification settings

MathewDavidov/find-file-extension

Repository files navigation

find-file-extension

npm version Buid Status

The npm package find-file-extension searches for a specified file type in a given directory or directories and returns an array of file paths. Unlike Node.js's fs.readdir(), which only reads through the directory without a rescursive option, this program will recursively find all file paths with the given extension within a subdirectory or subdirectories.

Installation

npm i find-file-extension

Usage

const { searchFiles } = require("find-file-extension");

// Single directory usage
const filePaths = searchFiles("js", "./src");

// Multiple directory usage
const filePaths = searchFiles("js", "./src", "./test");
const filePaths = searchFiles("jsx", "./src/components", "./src/store", "./src/app");

About

Searches for a specified file type in a given directory or directories and returns an array of file paths

Resources

License

Stars

Watchers

Forks

Packages

No packages published