tinyimg - v1.1.1
    Preparing search index...

    Interface TransformResult

    The result of a one-shot transformation.

    Carries the bytes and the conveniences a Worker actually wants, so nobody has to build a Response or a data: URL by hand.

    interface TransformResult {
        contentType: string;
        data: Uint8Array<ArrayBuffer>;
        degraded: readonly string[];
        flattened: boolean;
        format: ImageFormat;
        height: number;
        width: number;
        blob(): Blob;
        bytes(): Uint8Array<ArrayBuffer>;
        dataUrl(): string;
        response(headers?: HeadersInit): Response;
    }
    Index
    contentType: string

    Its content type.

    data: Uint8Array<ArrayBuffer>

    The encoded image.

    degraded: readonly string[]

    What the planner gave up to fit budgetMs, by name.

    Empty when no budget was given, when the request already fit, and on a pass-through, which costs a header read and never needs a lever. 'effort' means the decode ran fast; 'filter' means a filter left open went to nearest, and 'scale' means the decoder was asked for a further reduction and the result is softer. Changing container is not degrading and is reported by TransformResult.format instead.

    'compression' is the one that costs bytes rather than fidelity: a lossless output's compressor was turned down because the encoder alone was over budget. It never appears when TransformOptions.compression named a level.

    The same lossy-outcome-you-may-want-to-refuse shape as TransformResult.flattened.

    flattened: boolean

    Set when the source held several frames and this output holds only the first.

    There is no animated encoder, so any request that actually has work to do reduces an animation to a still. That is a lossy outcome a caller may want to avoid rather than discover, by serving the original or by asking for a request that passes through.

    format: ImageFormat

    What it was encoded as.

    height: number

    Height of the output in pixels.

    width: number

    Width of the output in pixels.

    • The encoded bytes.

      Returns Uint8Array<ArrayBuffer>

    • The bytes as a Response, typed and length-set.

      Parameters

      • Optionalheaders: HeadersInit

      Returns Response