(prefix: string[])
| 217 | |
| 218 | const glob = new Bun.Glob("**/*") |
| 219 | export async function list(prefix: string[]) { |
| 220 | const dir = await state().then((x) => x.dir) |
| 221 | try { |
| 222 | const result = await Array.fromAsync( |
| 223 | glob.scan({ |
| 224 | cwd: path.join(dir, ...prefix), |
| 225 | onlyFiles: true, |
| 226 | }), |
| 227 | ).then((results) => results.map((x) => [...prefix, ...x.slice(0, -5).split(path.sep)])) |
| 228 | result.sort() |
| 229 | return result |
| 230 | } catch { |
| 231 | return [] |
| 232 | } |
| 233 | } |
| 234 | } |