(dirPath: string)
| 43 | } |
| 44 | |
| 45 | async readdir(dirPath: string): Promise<string[]> { |
| 46 | const normalized = dirPath === '/' ? '' : dirPath.startsWith('/') ? dirPath.slice(1) : dirPath; |
| 47 | const prefix = normalized ? normalized + '/' : ''; |
| 48 | const results = new Set<string>(); |
| 49 | |
| 50 | for (const filePath of this.files.keys()) { |
| 51 | if (filePath.startsWith(prefix)) { |
| 52 | const relative = filePath.slice(prefix.length); |
| 53 | const firstPart = relative.split('/')[0]; |
| 54 | if (firstPart) { |
| 55 | results.add(firstPart); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | return Array.from(results); |
| 61 | } |
| 62 | |
| 63 | async stat(path: string): Promise<{ |
| 64 | type: 'file' | 'dir'; |
no test coverage detected