ben-rogerson / get-files-in

πŸ“‘ A simple script that synchronously returns a list of file paths of specified types from a directory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get files in

A Node.js script that synchronously returns a list of file paths of specified types from a directory or directories.

Install

npm install -D get-files-in

Usage

getFilesIn(folderPath, matchFiletypes = [], checkSubDirectories = false)
require()
getFilesIn(path.resolve(__dirname, source.styles), [
    "scss",
    "sass",
    "less",
]
// [
//  '/Users/hotstuff/project/src/styles/main.scss',
//  '/Users/hotstuff/project/src/styles/hello.sass',
// ]
require()
getFilesIn(path.resolve(__dirname, source.styles), [
    "scss",
    "sass",
    "less",
], true
// [
//  '/Users/hotstuff/project/src/styles/main.scss',
//  '/Users/hotstuff/project/src/styles/hello.sass',
//  '/Users/hotstuff/project/src/styles/subfolders-allowed/index.sass',
// ]

History

This package was created for the Agency Webpack Mix Config. The package was updated to use Globby because it uses an improved syntax to select files.

About

πŸ“‘ A simple script that synchronously returns a list of file paths of specified types from a directory


Languages

Language:JavaScript 100.0%