async function mapFiles(dir, mapfn, rootDir) {
	const entries = await fs.readdir(dir, { withFileTypes: true });
	const results = await Promise.all(
		entries.map((entr) => {
			const absPath = path.resolve(dir, entr.name);
			return entr.isDirectory()
				? mapFiles(absPath, mapfn, rootDir)
				: mapfn(absPath, rootDir);
		})
	);
	return Array.prototype.concat(...results);
}
/// Run a function for each file in a directory and its subdirectories and return an array with all results.
Run a function for each file in a directory and its subdirectories and return an array with all results.
Run a function for each file in a directory and its subdirectories and return an array with all results .
async function mapFiles(dir, mapfn, rootDir) {
	const entries = await fs.readdir(dir, { withFileTypes: true });
	const results = await Promise.all(
		entries.map((entr) => {
			const absPath = path.resolve(dir, entr.name);
			return entr.isDirectory()
				? mapFiles(absPath, mapfn, rootDir)
				: mapfn(absPath, rootDir);
		})
	);
	return Array.prototype.concat(...results);
}
async function mapFiles ( dir , mapfn , rootDir ) { const entries = await fs . readdir ( dir , { withFileTypes : true } ) ; const results = await Promise . all ( entries . map ( ( entr ) => { const absPath = path . resolve ( dir , entr . name ) ; return entr . isDirectory ( ) ? mapFiles ( absPath , mapfn , rootDir ) : mapfn ( absPath , rootDir ) ; } ) ) ; return Array . prototype . concat ( ... results ) ; }
Run a function for each file in a directory and its subdirectories and return an array with all results.
Run a function for each file in a directory and its subdirectories and return an array with all results .