MCPcopy Create free account
hub / github.com/LibPDF-js/core / toHexString

Function toHexString

src/test-utils.ts:86–94  ·  view source on GitHub ↗
(bytes: Uint8Array, maxLength = 100)

Source from the content-addressed store, hash-verified

84 * ```
85 */
86export 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).

Callers 1

index.test.tsFile · 0.90

Calls 4

sliceMethod · 0.80
mapMethod · 0.80
fromMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected