hasPreset
function hasPreset(asset, preset): boolean;Defined in: packages/asset-client/src/index.ts:924
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).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
asset |
{ presets?: string | null; } |
asset.presets? |
string | null |
preset |
VariantPreset |
Returns
Section titled “Returns”boolean
Example
Section titled “Example”import { hasPreset } from "@nitida/asset-client";
hasPreset({ presets: "oq" }, "original"); // → true ("o" = original, "q" = thumb)hasPreset({ presets: "oq" }, "lg"); // → false — do not link to ithasPreset({ presets: "pv" }, "aiproxy"); // → false — video without the AI proxy