(dir: string)
| 2 | import * as path from 'path'; |
| 3 | |
| 4 | async function getFiles(dir: string): Promise<string | string[]> { |
| 5 | const dirents = await fs.readdir(dir, { withFileTypes: true }); |
| 6 | const files = await Promise.all( |
| 7 | dirents.map((dirent) => { |
| 8 | const res = path.resolve(dir, dirent.name); |
| 9 | return dirent.isDirectory() ? getFiles(res) : res; |
| 10 | }) |
| 11 | ); |
| 12 | return Array.prototype.concat(...files); |
| 13 | } |
| 14 | |
| 15 | export async function uploadDir( |
| 16 | uploadFile: (args: { |