(entries: Array<TarInputEntry>)
| 170 | } |
| 171 | |
| 172 | export function buildTar(entries: Array<TarInputEntry>): Uint8Array { |
| 173 | const chunks: Uint8Array[] = []; |
| 174 | for (const entry of entries) { |
| 175 | const header = createTarHeader(entry); |
| 176 | chunks.push(header); |
| 177 | if (entry.type === "file") { |
| 178 | chunks.push(entry.bytes); |
| 179 | const remainder = entry.bytes.byteLength % 512; |
| 180 | if (remainder !== 0) { |
| 181 | chunks.push(new Uint8Array(512 - remainder)); |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | chunks.push(new Uint8Array(1024)); |
| 186 | return concatBytes(chunks); |
| 187 | } |
| 188 | |
| 189 | export function listTar(bytes: Uint8Array): StateArchiveEntry[] { |
| 190 | return parseTar(bytes) |
no test coverage detected