https://github.com/ben-rogerson/get-files-in
📑 A simple script that synchronously returns a list of file paths of specified types from a directory
https://github.com/ben-rogerson/get-files-in
file-path nodejs
Last synced: about 1 month ago
JSON representation
📑 A simple script that synchronously returns a list of file paths of specified types from a directory
- Host: GitHub
- URL: https://github.com/ben-rogerson/get-files-in
- Owner: ben-rogerson
- Created: 2019-06-24T21:40:12.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-28T01:56:54.000Z (almost 7 years ago)
- Last Synced: 2025-02-24T11:05:25.341Z (over 1 year ago)
- Topics: file-path, nodejs
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Get files in
A Node.js script that synchronously returns a list of file paths of specified types from a directory or directories.
## Install
```bash
npm install -D get-files-in
```
## Usage
```js
getFilesIn(folderPath, matchFiletypes = [], checkSubDirectories = false)
```
```js
require()
getFilesIn(path.resolve(__dirname, source.styles), [
"scss",
"sass",
"less",
]
// [
// '/Users/hotstuff/project/src/styles/main.scss',
// '/Users/hotstuff/project/src/styles/hello.sass',
// ]
```
```js
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](https://github.com/ben-rogerson/agency-webpack-mix-config).
The package was updated to use [Globby](https://github.com/sindresorhus/globby) because it uses an improved syntax to select files.