edgeport - v1.0.6
    Preparing search index...

    Interface RedisReply

    A single reply with accessors for the shapes callers actually want.

    raw is always the faithful RespValue; the accessors sit on top of it. Every accessor except RedisReply.error and RedisReply.raw throws when the reply is an error, so a failed command in a RedisSession.pipeline batch can never be read as data by accident.

    1.0.6

    interface RedisReply {
        error?: string;
        isNull: boolean;
        raw: RespValue;
        value: RedisNative;
        boolean(): boolean;
        bytes(): Uint8Array;
        items(): RedisReply[];
        json<T = unknown>(): T;
        map(): Record<string, string>;
        number(): number;
        strings(): string[];
        text(): string;
    }
    Index
    error?: string

    The error message when the server replied with an error (- or !), otherwise undefined.

    isNull: boolean

    Whether the reply is a null (RESP3 _, or the RESP2 $-1 / *-1 forms).

    The decoded RESP value, exactly as the server sent it.

    The reply projected onto plain JavaScript.

    • Returns the reply as a boolean: a RESP3 boolean directly, a non-zero integer, OK, or a non-null bulk string as true; null and zero as false.

      Returns boolean

      The boolean value.

      If the reply is an error.

    • Returns the reply's raw bytes, for values that are binary rather than text.

      Returns Uint8Array

      The bytes; empty for a null reply.

      If the reply is an error or an aggregate.

    • Wraps each element of an aggregate reply (array, set, push, or a map flattened to key-value pairs) as its own RedisReply.

      Returns RedisReply[]

      The element replies.

      If the reply is an error or not an aggregate.

    • Decodes the reply as UTF-8 then parses it as JSON.

      Type Parameters

      • T = unknown

        The expected shape of the decoded value.

      Returns T

      The parsed value.

      If the reply is an error or is not valid JSON.

    • Decodes a field-value reply as an object, accepting either a RESP3 map or the flat even-length array RESP2 uses for the same data.

      Returns Record<string, string>

      The fields as a string-to-string object.

      If the reply is an error, not an aggregate, or has an odd length.

    • Returns the reply as a number (integer, double, or a numeric string).

      Returns number

      The numeric value.

      If the reply is an error, null, or not numeric.

    • Decodes an aggregate reply as a list of strings.

      Returns string[]

      The elements as text; a null element becomes the empty string.

      If the reply is an error or not an aggregate.

    • Decodes the reply as text: simple and bulk strings verbatim, numbers stringified, null as the empty string (check RedisReply.isNull to tell them apart).

      Returns string

      The reply as a string.

      If the reply is an error or an aggregate.