getFiles

Recursively get all files in a directory

Usage

needs โ€“allow-read privilege

import getFiles 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'],
});

API

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โ€™]}

Examples