Package Exports
- @tb.p/get-exts
- @tb.p/get-exts/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tb.p/get-exts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
get-exts
A command-line tool to scan directories recursively and return a list of file extensions found within them.
Installation
Global Installation
npm install -g get-extsUsing npx (Recommended)
npx get-exts [directories...] [options]Usage
Basic Usage
# Scan current directory
get-exts
# Scan specific directories
get-exts /path/to/directory1 /path/to/directory2
# Scan multiple directories
get-exts src/ lib/ tests/Options
-c, --count- Show count of files for each extension-h, --hidden- Include hidden files and directories-e, --exclude-dirs <dirs>- Comma-separated list of directories to exclude (default: node_modules,.git,.vscode,.idea)-x, --exclude-exts <extensions>- Comma-separated list of extensions to exclude-j, --json- Output results in JSON format-s, --sort <method>- Sort method: count, name, or none (default: name)-f, --formatted- Output in formatted display mode (default is plain comma-separated)-V, --version- Show version number--help- Show help information
Examples
# Basic scan of current directory
get-exts
# Scan with file counts
get-exts --count
# Include hidden files
get-exts --hidden
# Exclude specific directories
get-exts --exclude-dirs "node_modules,dist,build"
# Exclude specific extensions
get-exts --exclude-exts ".log,.tmp,.cache"
# Output as JSON
get-exts --json
# Formatted display mode
get-exts --formatted
# Formatted output with counts
get-exts --formatted --count
# Sort by count (most files first)
get-exts --count --sort count
# Scan multiple directories with custom options
get-exts src/ lib/ --count --exclude-dirs "node_modules,temp" --jsonFeatures
- Recursive Scanning: Automatically scans subdirectories
- Smart Exclusions: Excludes common directories like
node_modules,.git, etc. - Hidden File Support: Option to include or exclude hidden files
- Extension Filtering: Exclude specific file extensions from results
- Count Mode: Show how many files exist for each extension
- Multiple Output Formats: Plain text or JSON output
- Flexible Sorting: Sort by extension name or file count
- Multiple Directory Support: Scan multiple directories at once
Output Examples
Default Output (comma-separated without dots)
js,json,md,txtFormatted Output
File Extensions Found:
==============================
.js
.json
.md
.txt
==============================
Scanned 1 directory: .Count Mode Output
File Extensions Found:
==============================
.js: 15
.json: 3
.md: 2
.txt: 1
==============================
Scanned 1 directory: .JSON Output
{
".js": 15,
".json": 3,
".md": 2,
".txt": 1
}Default Output with Counts
js:15,json:3,md:2,txt:1Development
Local Development
# Clone the repository
git clone <repository-url>
cd get-exts
# Install dependencies
npm install
# Run locally
npm start
# Or run the CLI directly
node bin/cli.jsPublishing to npm
# Login to npm
npm login
# Publish the package
npm publishLicense
MIT
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Issues
If you encounter any issues or have feature requests, please open an issue on the GitHub repository.