6.0.0 • Published 8 months ago

@flowr/node v6.0.0

Weekly downloads
-
License
(LicenseRef-OQL-1...
Repository
github
Last release
8 months ago

@flowr/node

Node-specific opinionated TypeScript utilities.

Installation

You can use the following command to install this package, or replace pnpm add -D with your package manager of choice.

pnpm add -D @flowr/node

Utilities

findFilesRecursively

Recursively searches for files in a directory and returns an AsyncIterableIterator of the found paths.

import { findFilesRecursively } from '@flowr/node';

const files = findFilesRecursively('./src');
for await (const file of files)
	console.log(file);

// This, for example, could log:
// /root/src/index.js
// /root/src/database.csv
// /root/src/lib/utils/constants.json

// Alternate forms:
const files = findFilesRecursivelyStringStartsWith('./src', 'index'); // filename starts with "index"
const files = findFilesRecursivelyStringEndsWith('./src', '.js'); // filename ends with ".js"
const files = findFilesRecursivelyStringIncludes('./src', 'database'); // filename includes "database"
const files = findFilesRecursivelyRegex('./src', /\.[tj]sx?$/); // filename matches the regex
6.0.0

8 months ago

5.3.0

8 months ago

5.2.0

9 months ago

5.1.0

9 months ago

5.0.0

10 months ago