(
path: string,
destination: string
)
| 330 | } |
| 331 | |
| 332 | async extractArchive( |
| 333 | path: string, |
| 334 | destination: string |
| 335 | ): Promise<StateArchiveExtractResult> { |
| 336 | const entries = extractTar(await this.readFileBytes(path)); |
| 337 | for (const entry of entries) { |
| 338 | const destPath = |
| 339 | destination === "/" ? `/${entry.path}` : `${destination}/${entry.path}`; |
| 340 | if (entry.type === "directory") { |
| 341 | await this.mkdir(destPath, { recursive: true }); |
| 342 | } else if (entry.bytes) { |
| 343 | await this.writeFileBytes(destPath, entry.bytes); |
| 344 | } |
| 345 | } |
| 346 | return { |
| 347 | destination, |
| 348 | entries: entries.map((entry) => ({ |
| 349 | path: entry.path, |
| 350 | type: entry.type, |
| 351 | size: entry.bytes?.byteLength ?? 0 |
| 352 | })) |
| 353 | }; |
| 354 | } |
| 355 | |
| 356 | async compressFile( |
| 357 | path: string, |
nothing calls this directly
no test coverage detected