Synchronously walks through a directory and its subdirectories, returning an array of file paths.
npm install @puppedo/walk-syncSynchronously walks through a directory and its subdirectories, returning an array of file paths.
``bash`
npm install @puppedo/walk-sync
`typescript
import { walkSync } from '@puppedo/walk-sync';
const files = walkSync('./my-directory', {
ignoreFolders: ['node_modules', '.git'], // Optional: folders to exclude from the walk
includeExtensions: ['.ts', '.js'], // Optional: only include files with these extensions
ignoreFiles: ['.eslintrc.js', 'tsconfig.json'], // Optional: specific files to exclude
depth: 2, // Optional: limits the recursion depth
onlyFiles: ['package.json', 'index.ts'], // Optional: include only specific files
fullPathReturn: true, // Optional: return full paths instead of relative paths
});
console.log(files); // Output: array of file paths
``
ISC