0.0.1 • Published 8 years ago
require-paths-in-cwd v0.0.1
require-paths-in-cwd
Like require.resolve.paths(), but only retrieves paths inside the current working directory
Installation
npm install require-paths-in-cwdAPI
const readdirClean = require('require-paths-in-cwd');readdirClean(path)
path: string Buffer URL (directory path)
Return: Promise<Array<string>>
Similar to Node.js built-in fs.readdir, but different in the following points:
- Returns a
Promise - Doesn't support
encodingoption - The paths are filtered with
require('junk').not
readdirClean('path/to/dir').then(paths => {
paths.includes('.Spotlight-V100'); //=> false
paths.includes('.Trashes'); //=> false
paths.includes('Desktop.ini'); //=> false
});License
ISC License © 2017 Shinnosuke Watanabe