UNPKG

simplify-cord

Version:

SimplifyCord is an unofficial extension of the 'discord.js' library. Our extension aims to simplify the development of Discord bots, promoting cleaner code and easier maintenance.

16 lines (13 loc) 528 B
import * as fs from 'fs'; import * as path from 'path'; export default { getRecursiveFiles(dir: string): string[] | null { if (!fs.existsSync(dir)) return null; const dirents = fs.readdirSync(dir, { withFileTypes: true }); const files = dirents.map(dirent => { const res = path.resolve(dir, dirent.name); return dirent.isDirectory() ? this.getRecursiveFiles(res) : res; }); return Array.prototype.concat(...files) as string[]; } }