(
dirPath: string,
baseDir: string = dirPath,
fileList: Record<string, Uint8Array> = {},
additionalPatterns: string[] = [],
)
| 77 | } |
| 78 | |
| 79 | export function getAllFiles( |
| 80 | dirPath: string, |
| 81 | baseDir: string = dirPath, |
| 82 | fileList: Record<string, Uint8Array> = {}, |
| 83 | additionalPatterns: string[] = [], |
| 84 | ): Record<string, Uint8Array> { |
| 85 | const files = readdirSync(dirPath); |
| 86 | |
| 87 | const ignoreChecker = buildIgnoreChecker(additionalPatterns); |
| 88 | |
| 89 | for (const file of files) { |
| 90 | const filePath = join(dirPath, file); |
| 91 | const relativePath = relative(baseDir, filePath); |
| 92 | |
| 93 | if (ignoreChecker.ignores(relativePath)) { |
| 94 | continue; |
| 95 | } |
| 96 | |
| 97 | const stat = statSync(filePath); |
| 98 | |
| 99 | if (stat.isDirectory()) { |
| 100 | getAllFiles(filePath, baseDir, fileList, additionalPatterns); |
| 101 | } else { |
| 102 | // Use forward slashes in zip file paths |
| 103 | const zipPath = relativePath.split(sep).join("/"); |
| 104 | fileList[zipPath] = readFileSync(filePath); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | return fileList; |
| 109 | } |
| 110 | |
| 111 | interface FileWithPermissions { |
| 112 | data: Uint8Array; |
no test coverage detected
searching dependent graphs…