RabeDatta / find-file-extension

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

License:MIT License


Languages

Language:JavaScript 100.0%