arraydir

递归遍历目录

Usage no npm install needed!

<script type="module">
  import arraydir from 'https://cdn.skypack.dev/arraydir';
</script>

README

arraydir模块

递归遍历目录

import * as arraydir from 'arraydir';
const currentPath = path.resolve(__dirname) + arraydir.PS;

const fileList = arraydir
    .load(interfacePath)
    .filter(file => /\.(js)$/i.test(file));
console.log(fileList);
[
  'app.js',
  'index.js',
  'test.js',
  'lib/test.js'
]
module 'arraydir' {
  /**
   * 目录分隔符,Linux/Mac下为 / ;Win下为 \ 
   */
  export var PS: string;
  export function load(path: string) : string[]
}