extension-scan
v1.0.1
Published
Scan directories and list found file extensions
Maintainers
Readme
extension-scan
Scan directories and report found file extensions — useful for quick inventorying and auditing of project files.
Features
- Fast file discovery using
fast-glob - CLI entrypoint with common options (ignore patterns, include hidden files, verbose)
- Programmatic API via
scanExtensionsfor embedding in scripts
Quick Start
Install
Install globally to use as a CLI:
npm install -g extension-scan
# or with pnpm
pnpm add -g extension-scanor install locally in your project:
npm install extension-scan
# or with pnpm
pnpm add extension-scanCLI Usage
Run the scanner against the current directory:
extension-scanScan a specific folder, include hidden files and show filenames for each extension:
extension-scan ./src -d -vShow only extension names (one per line):
extension-scan ./ -oOptions (short):
-i, --ignore <patterns...>: File/folder patterns to ignore (defaults includenode_modules/**,.git/**)-d, --dot: Include hidden files-v, --verbose: Print file list per extension-o, --only-extensions: Output only extension names
Programmatic Usage
Import and call scanExtensions from scanner.js:
const { scanExtensions } = require("./scanner");
(async () => {
const results = await scanExtensions(process.cwd(), { includeHidden: false });
console.log(results);
})();The function returns either:
- An array of extension names when
onlyExtensions: true - An array of objects
{ extension, files, totalFiles }otherwise
Files of Interest
- index.js — package entry
- bin.js — CLI wrapper using
commander - scanner.js — core scanning logic
License
This project is published under the ISC license. See the LICENSE file for details.
