Skip to content

hasPreset

function hasPreset(asset, preset): boolean;

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

Did the processor actually generate this preset?

Reads dto.presets — the compact 1-char code string the server always sends. Prefer this over the variants array, which is documented as present on admin responses and, measured 2026-08-15, comes back EMPTY even with an admin key while the database row holds the variants.

Parameter Type
asset Pick<AssetDTO, "presets">
preset VariantPreset

boolean

import { hasPreset } from "@aquienpz/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