A CLI utility to recursively dump the contents of text files, respecting .gitignore patterns.
It's like cat but for directories, with built-in support for filtering based on gitignore rules, and additional include/exclude patterns.
- Recursively process directories.
- Automatically respects
.gitignorefiles. - Optionally use a global
.gitignorefile. - Filter files with additional include and exclude glob patterns.
- List file names only or count them.
- Handles text and binary files gracefully.
- Cross-platform (Windows, macOS, Linux).
Install dependencies:
npm installTo use the dump command globally from any directory, you can link the script:
npm linkThis will make the dump command available in your system's path.
dump [options] <file|directory|glob> [more...]
-h, --help: Show the help message.-n, --names-only: Only show file paths, no content.-c, --count-only: Only count how many files would be dumped.-g, --gitignore <file>: Path to a.gitignorefile to use.-e, --exclude-pattern <list>: Space-separated glob patterns to additionally ignore.-i, --include-pattern <list>: Space-separated glob patterns to exclusively include.
- Dump a single file:
dump README.md
- Dump a whole directory:
dump src/
- List file names only:
dump -n .env config/notes.txt
- Count all files in the current directory:
dump -c . - Use a specific gitignore file:
dump -g ../../.gitignore packages/api
- Count all
.vuefiles while respecting a gitignore:dump frontend/**/*.vue -c -g ../../.gitignore
- Exclude all markdown and java files:
dump -e "*.md *.java" .
- Include only JavaScript files:
dump -i "**/*.js" .
- Pipe all JavaScript files into the clipboard (Windows PowerShell):
dump -i "**/*.js" . | Set-Clipboard
Contributions are welcome! Please see the CONTRIBUTING.md file for details.
This project is licensed under the MIT License - see the LICENSE file for details.