getFiles
Recursively get all files in a directory
Usage
needs โallow-read privilege
import getFiles, { exists } from "https://deno.land/x/getfiles/mod.ts";
// root path: './' or '.'
const files = getFiles('./');
// include files
const files2 = getFiles({
dir: './',
include: ['examples'],
// ignore: ['examples/include.ts'],
});
// exclude files
const files3 = getFiles({
dir: './',
exclude: ['.git'],
// ignore: ['*.ts'],
});
const existFile = await exists('mod.ts');
console.log(existFile);
Method
- getFiles
- exists
API
getFiles
Option | Type | Description | Example |
---|---|---|---|
dir | string | directory | {dir: โ.โ} |
include | string[] | include directory | {dir: โ.โ, include: [โexamplesโ]} |
exclude | string[] | exclude directory | {dir: โ.โ, exclude: [โ.gitโ]} |
ignore | string[] | ignore file rule | {dir: โ.โ, ignore: [โ*.tsโ, โ*.mdโ, โexamples/tree.tsโ]} |