Skip to content
scroll to zoom · drag to pan

hasPreset

function hasPreset(asset, preset): boolean;

Defined in: packages/asset-client/dist/index.d.ts:1182

Did the processor actually generate this preset?

Reads dto.presets — the compact 1-char code string the server sends on EVERY shape, including the slim list/resolver one that carries no variants at all. That is why this exists and why it stays the right existence check even now that GET /assets/:id really does send variants (it did not until the 2026-08-17 deploy).

Parameter Type
asset { presets?: string | null; }
asset.presets? string | null
preset VariantPreset

boolean

import { hasPreset } from "@nitida/asset-client";
hasPreset({ presets: "oq" }, "original"); // → true ("o" = original, "q" = thumb)
hasPreset({ presets: "oq" }, "lg"); // → false — do not link to it
hasPreset({ presets: "pv" }, "aiproxy"); // → false — video without the AI proxy