mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-27 21:21:03 +00:00
feat(bots/discord): add source
This commit is contained in:
17
bots/discord/src/utils/fs.ts
Normal file
17
bots/discord/src/utils/fs.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { join } from 'path'
|
||||
import { readdir, stat } from 'fs/promises'
|
||||
|
||||
export async function listAllFilesRecursive(dir: string): Promise<string[]> {
|
||||
const files = await readdir(dir)
|
||||
const result: string[] = []
|
||||
for (const file of files) {
|
||||
const filePath = join(dir, file)
|
||||
const fileStat = await stat(filePath)
|
||||
if (fileStat.isDirectory()) {
|
||||
result.push(...(await listAllFilesRecursive(filePath)))
|
||||
} else {
|
||||
result.push(filePath)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user