(current)
| 73 | const results = []; |
| 74 | |
| 75 | async function walk(current) { |
| 76 | let entries; |
| 77 | try { |
| 78 | entries = await readdir(current, {withFileTypes: true}); |
| 79 | } catch { |
| 80 | return; |
| 81 | } |
| 82 | for (const entry of entries) { |
| 83 | const fullPath = join(current, entry.name); |
| 84 | if (entry.isDirectory()) { |
| 85 | await walk(fullPath); |
| 86 | } else if (entry.isFile() && entry.name.endsWith('.md')) { |
| 87 | if (!filter || filter(fullPath)) { |
| 88 | results.push(fullPath); |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | await walk(dir); |
| 95 | return results; |