(block: Uint8Array, offset: number, length: number)
| 754 | } |
| 755 | |
| 756 | const readString = (block: Uint8Array, offset: number, length: number): string => { |
| 757 | let end = offset |
| 758 | let ascii = true |
| 759 | const limit = offset + length |
| 760 | while (end < limit && block[end] !== 0) { |
| 761 | if (block[end] >= 0x80) ascii = false |
| 762 | end++ |
| 763 | } |
| 764 | if (end === offset) return "" |
| 765 | if (!ascii || end - offset > 256) return textDecoder.decode(block.subarray(offset, end)) |
| 766 | // Most header strings are short ASCII, which is cheaper to build directly |
| 767 | return String.fromCharCode.apply(null, block.subarray(offset, end) as unknown as Array<number>) |
| 768 | } |
| 769 | |
| 770 | const readOctal = (block: Uint8Array, offset: number, length: number): number => { |
| 771 | let start = offset |
no test coverage detected