Skip to content

zeropdf v1.3.0


zeropdf / BinaryData

Type Alias: BinaryData

ts
type BinaryData = Uint8Array | ArrayBuffer;

Defined in: src/types.ts:610

Binary input accepted by the library.

Accepted types:

  • Uint8Array
  • ArrayBuffer

Node.js Buffer (which extends Uint8Array) works directly. Browser Blob values must be converted first:

Example

ts
// Node.js Buffer — works directly
import { readFileSync } from "node:fs";
const fontBytes: BinaryData = readFileSync("font.ttf"); // Buffer extends Uint8Array

// Browser Blob — convert first
const blob = await fetch("image.png").then(r => r.blob());
const imageBytes: BinaryData = await blob.arrayBuffer();

Released under the ISC license.