(current: string)
| 63 | const snapshot = new Map<string, string>(); |
| 64 | |
| 65 | async function walk(current: string): Promise<void> { |
| 66 | const entries = await fs.readdir(current, { withFileTypes: true }); |
| 67 | for (const entry of entries) { |
| 68 | const absolute = path.join(current, entry.name); |
| 69 | const relative = path.relative(root, absolute).split(path.sep).join('/'); |
| 70 | if (entry.isDirectory()) { |
| 71 | snapshot.set(`${relative}/`, ''); |
| 72 | await walk(absolute); |
| 73 | } else { |
| 74 | snapshot.set(relative, await fs.readFile(absolute, 'utf-8')); |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | await walk(root); |
| 80 | return snapshot; |
no test coverage detected