Registry / devops / list-paths

list-paths

JSON →
library1.0.2jsnpmunverified

list-paths is a Node.js utility that returns all directory paths (and optionally file paths) under a given directory, with sensible defaults to ignore node_modules, .git, and patterns from .gitignore. Version 1.0.2 is the current stable release; the package is minimal and stable with no recent updates. It differentiates from similar tools like glob or fast-glob by providing a simpler API focused solely on retrieving directory paths, with built-in filtering for Node.js projects. Ships TypeScript type definitions.

npm install list-paths
INSTALL
IMPORT
SIG · LIST-PATHS
L
list-paths
devopsjavascriptv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

listPaths
const listPaths = require('list-paths')
import listPaths from 'list-paths'
This package does not support ESM imports; use CommonJS require.
listPaths (named import)
const listPaths = require('list-paths')
const { listPaths } = require('list-paths')
The package exports a single default function, not a named export.
listPaths with options
listPaths('./src', { includeFiles: true })
listPaths('./src', { includeFiles: 'true' })
Options are booleans, not strings. Passing strings will be truthy but may cause unexpected behavior.

Demonstrates basic usage with default options, including files, and disabling node_modules filtering.

const listPaths = require('list-paths'); const dirs = listPaths(); console.log(dirs); // Example output: [ './', './public', './src', './src/helpers' ] const srcDirs = listPaths('./src', { includeFiles: true }); console.log(srcDirs); // Example output: [ './src', './src/index.js', './src/helpers', './src/helpers/util.js' ] const rootDirs = listPaths('.', { ignoreNodeModules: false }); console.log(rootDirs); // Example output: [ './', './node_modules', './src' ]
Debug
Known issues
gotchaThe package only returns directory paths by default; to include files set includeFiles: true.
fix
Pass { includeFiles: true } as second argument to listPaths.
affects: >=1.0.0
gotchaOptions ignoreNodeModules, ignoreGit, and useGitIgnore default to true; if you want to see those directories/paths, set them to false.
fix
Explicitly set options to false when needed, e.g., { ignoreNodeModules: false }.
affects: >=1.0.0
gotchaThe returned paths are relative to the provided path, not absolute. They always start with './'.
fix
Use path.resolve() or path.join(__dirname, ...) to get absolute paths if needed.
affects: >=1.0.0
deprecatedNo breaking changes or deprecations reported as of version 1.0.2.
fix
N/A
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: listPaths is not a function
Using ESM import syntax ('import listPaths from...') with this CommonJS-only package.
fix
Use require('list-paths') instead of import.
Cannot find module 'list-paths'
Package not installed or typo in package name.
fix
Run 'npm install list-paths' and ensure node_modules includes it.
TypeError: listPaths(...) is not iterable
Passing an invalid path or options that cause an error; listPaths returns undefined on failure.
fix
Check that the path exists and is a directory; use try/catch around the call.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
list-paths — npm install list-paths · libregistry