Gathering detailed insights and metrics for @puppedo/walk-sync
Gathering detailed insights and metrics for @puppedo/walk-sync
npm install @puppedo/walk-sync
Typescript
Module System
Node Version
NPM Version
65.9
Supply Chain
89.5
Quality
79.2
Maintenance
100
Vulnerability
99.6
License
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
344
Last Day
1
Last Week
9
Last Month
42
Last Year
344
Minified
Minified + Gzipped
Latest Version
1.0.4
Package Id
@puppedo/walk-sync@1.0.4
Unpacked Size
7.60 kB
Size
3.04 kB
File Count
5
NPM Version
10.2.3
Node Version
20.17.0
Publised On
15 Nov 2024
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
80%
9
Compared to previous week
Last month
40%
42
Compared to previous month
Last year
0%
344
Compared to previous year
32
Synchronously walks through a directory and its subdirectories, returning an array of file paths.
1npm install @puppedo/walk-sync
1import { walkSync } from '@puppedo/walk-sync'; 2 3const files = walkSync('./my-directory', { 4 ignoreFolders: ['node_modules', '.git'], 5 includeExtensions: ['.ts', '.js'], 6 ignoreFiles: ['.eslintrc.js', 'tsconfig.json'], 7 depth: 2, // Optional: limits the recursion depth 8}); 9 10console.log(files); // Output: array of file paths
walkSync(dir, options)
dir
: string
- The directory to start walking from.
options
: object
- Options for the walk.
ignoreFolders
: string[]
- An array of folder names to ignore.includeExtensions
: string[]
- An array of file extensions to include. If not provided, all file extensions are included.ignoreFiles
: string[]
- An array of file names to ignore. Matching is done against the full file name, not just the extension.depth
: number
- The maximum depth to walk. A value of 1
will only include files directly within the dir
directory. If not provided, there is no depth limit.Returns: string[]
- An array of file paths.
1const files = walkSync('./path/to/directory'); 2console.log(files);
1const files = walkSync('./path/to/directory', { 2 ignoreFolders: ['node_modules', 'dist'], 3}); 4console.log(files);
1const tsFiles = walkSync('./path/to/directory', { 2 includeExtensions: ['.ts'], 3}); 4console.log(tsFiles);
1const files = walkSync('./path/to/directory', { 2 depth: 1, // Only files directly in the directory 3}); 4console.log(files);
ISC
No vulnerabilities found.
No security vulnerabilities found.