Skip to content
scroll to zoom · drag to pan

AssetVariant

type AssetVariant = {
bytes: number;
createdAt?: string;
height?: number;
preset: VariantEntryPreset;
rungs?: HlsRung[];
sourceFrom?: | VariantPreset
| "upload"
| "transform-route"
| "hls-transcode"
| "cdn-probe";
url: string;
width?: number;
};

Defined in: packages/asset-client/src/index.ts:244

bytes: number;

Defined in: packages/asset-client/src/index.ts:258

Byte size of the stored variant file.


optional createdAt?: string;

Defined in: packages/asset-client/src/index.ts:281

ISO timestamp this variant was written. Absent on pre-trace variants.


optional height?: number;

Defined in: packages/asset-client/src/index.ts:256

Pixel height. Same caveat as width.


preset: VariantEntryPreset;

Defined in: packages/asset-client/src/index.ts:250

What this entry IS. Usually a named preset; can also be a transform-<hash> cache artifact — see VariantEntryPreset before passing it to getAssetUrl.


optional rungs?: HlsRung[];

Defined in: packages/asset-client/src/index.ts:298

preset: "hls" only — the ladder’s rungs, in MASTER ORDER.

The reason this exists: an entry that only says there is a ladder leaves a consumer that plans a composition exactly as blind as no entry at all, because the ceiling of a composition is its weakest ingredient and there is no upscale. Before this field the only way to learn a clip’s real rungs was to fetch the master playlist — or worse, download the asset.

rungs[0] is the rung every client OPENS on (RFC 8216 §6.3.4 for native HLS; hls.js with startLevel unset uses “the first level in the manifest”), so the order is a delivery fact — do not sort it in place.

Use hlsLadderAlignment rather than eyeballing segments: a ladder can be complete and still unable to adapt.


optional sourceFrom?:
| VariantPreset
| "upload"
| "transform-route"
| "hls-transcode"
| "cdn-probe";

Defined in: packages/asset-client/src/index.ts:271

Where the bytes for this variant came from. Useful for quality traceability — a thumb with sourceFrom: "original" is the canonical case, while sourceFrom: "lg" means it was derived from an already-encoded WebP (slight quality compounding).

  • "upload" → first-write at /assets/process. The bytes came straight from the client’s PUT.
  • VariantPreset → regenerated from that preset’s variant.

Absent on variants written before the trace field existed.


url: string;

Defined in: packages/asset-client/src/index.ts:252

Public CDN URL of this variant.


optional width?: number;

Defined in: packages/asset-client/src/index.ts:254

Pixel width. Absent for original-only assets where image processing was skipped, or for video presets.