File streaming
verify takes asset bytes as a Uint8Array, or — for a file too large to hold in memory — a RangeSource that streams it from disk. A RangeSource is a JS object with length and a synchronous readAt — backed by fs.readSync in Node.js — so the SDK reads only the ranges it needs instead of loading the whole file. This is the same RangeSource shape the issuer's sign accepts, so a multi-GB video master streams while only a small image binder ever materializes full bytes.
import { openSync, readSync, fstatSync } from "node:fs";
function rangeSource(path: string) {
const fd = openSync(path, "r");
const { size } = fstatSync(fd);
return {
length: size,
readAt(offset: number, length: number) {
const buf = Buffer.alloc(length);
readSync(fd, buf, 0, length, offset);
return new Uint8Array(buf);
},
};
}
const source = rangeSource("master.mov");
const [credential] = await verifier.verify(source, []); // { manifest, binding }
Unlike sign, verify needs no format argument for a RangeSource — it sniffs the container from the leading bytes it reads. Recovery binders still apply to a streamed input: pass them as the second argument (a streamed video master typically carries its ISCC out of band, recovered via Binder.held(...)).
Supported file types
Images (JPEG, PNG, AVIF, WebP, HEIC, TIFF, GIF, DNG, SVG), audio (MP3, WAV, FLAC, M4A), video (MP4, MOV), and PDF. The SDK detects the format from the container, so both in-memory Uint8Array bytes and a streamed RangeSource are accepted in every case. An MXF broadcast master is verified through the same RangeSource once its opt-in container plugin is registered.
See also
- Verify an asset: the full verification flow
- Recovery: registry lookup by binding