(bytes: Uint8Array, maxLength = 100)
| 84 | * ``` |
| 85 | */ |
| 86 | export function toHexString(bytes: Uint8Array, maxLength = 100) { |
| 87 | const slice = bytes.slice(0, maxLength); |
| 88 | |
| 89 | const hex = Array.from(slice) |
| 90 | .map(b => b.toString(16).padStart(2, "0")) |
| 91 | .join(" "); |
| 92 | |
| 93 | return bytes.length > maxLength ? `${hex}...` : hex; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Convert a Uint8Array to an ASCII string (for debugging PDF structure). |
no test coverage detected