interface KV {
    delete(key: string): Promise<void>;
    get(
        key: string,
        options?: Partial<KVNamespaceGetOptions<undefined>>,
    ): Promise<null | string>;
    get(key: string, type: "text"): Promise<null | string>;
    get<ExpectedValue = unknown>(
        key: string,
        type: "json",
    ): Promise<null | ExpectedValue>;
    get(key: string, type: "arrayBuffer"): Promise<null | ArrayBuffer>;
    get(key: string, type: "stream"): Promise<null | ReadableStream<any>>;
    get(
        key: string,
        options?: KVNamespaceGetOptions<"text">,
    ): Promise<null | string>;
    get<ExpectedValue = unknown>(
        key: string,
        options?: KVNamespaceGetOptions<"json">,
    ): Promise<null | ExpectedValue>;
    get(
        key: string,
        options?: KVNamespaceGetOptions<"arrayBuffer">,
    ): Promise<null | ArrayBuffer>;
    get(
        key: string,
        options?: KVNamespaceGetOptions<"stream">,
    ): Promise<null | ReadableStream<any>>;
    getWithMetadata<Metadata = unknown>(
        key: string,
        options?: Partial<KVNamespaceGetOptions<undefined>>,
    ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
    getWithMetadata<Metadata = unknown>(
        key: string,
        type: "text",
    ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
        key: string,
        type: "json",
    ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
    getWithMetadata<Metadata = unknown>(
        key: string,
        type: "arrayBuffer",
    ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
    getWithMetadata<Metadata = unknown>(
        key: string,
        type: "stream",
    ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream<any>, Metadata>>;
    getWithMetadata<Metadata = unknown>(
        key: string,
        options: KVNamespaceGetOptions<"text">,
    ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
        key: string,
        options: KVNamespaceGetOptions<"json">,
    ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
    getWithMetadata<Metadata = unknown>(
        key: string,
        options: KVNamespaceGetOptions<"arrayBuffer">,
    ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
    getWithMetadata<Metadata = unknown>(
        key: string,
        options: KVNamespaceGetOptions<"stream">,
    ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream<any>, Metadata>>;
    list<Metadata = unknown>(
        options?: KVNamespaceListOptions,
    ): Promise<KVNamespaceListResult<Metadata, string>>;
    put(
        key: string,
        value:
            | string
            | ArrayBuffer
            | ArrayBufferView<ArrayBufferLike>
            | ReadableStream<any>,
        options?: KVNamespacePutOptions,
    ): Promise<void>;
}

Hierarchy

  • KVNamespace
    • KV

Methods

  • Parameters

    • key: string

    Returns Promise<void>

  • Parameters

    • key: string
    • Optionaloptions: Partial<KVNamespaceGetOptions<undefined>>

    Returns Promise<null | string>

  • Parameters

    • key: string
    • type: "text"

    Returns Promise<null | string>

  • Type Parameters

    • ExpectedValue = unknown

    Parameters

    • key: string
    • type: "json"

    Returns Promise<null | ExpectedValue>

  • Parameters

    • key: string
    • type: "arrayBuffer"

    Returns Promise<null | ArrayBuffer>

  • Parameters

    • key: string
    • type: "stream"

    Returns Promise<null | ReadableStream<any>>

  • Parameters

    • key: string
    • Optionaloptions: KVNamespaceGetOptions<"text">

    Returns Promise<null | string>

  • Type Parameters

    • ExpectedValue = unknown

    Parameters

    • key: string
    • Optionaloptions: KVNamespaceGetOptions<"json">

    Returns Promise<null | ExpectedValue>

  • Parameters

    • key: string
    • Optionaloptions: KVNamespaceGetOptions<"arrayBuffer">

    Returns Promise<null | ArrayBuffer>

  • Parameters

    • key: string
    • Optionaloptions: KVNamespaceGetOptions<"stream">

    Returns Promise<null | ReadableStream<any>>

  • Type Parameters

    • Metadata = unknown

    Parameters

    • key: string
    • Optionaloptions: Partial<KVNamespaceGetOptions<undefined>>

    Returns Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>

  • Type Parameters

    • Metadata = unknown

    Parameters

    • key: string
    • type: "text"

    Returns Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>

  • Type Parameters

    • ExpectedValue = unknown
    • Metadata = unknown

    Parameters

    • key: string
    • type: "json"

    Returns Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>

  • Type Parameters

    • Metadata = unknown

    Parameters

    • key: string
    • type: "arrayBuffer"

    Returns Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>

  • Type Parameters

    • Metadata = unknown

    Parameters

    • key: string
    • type: "stream"

    Returns Promise<KVNamespaceGetWithMetadataResult<ReadableStream<any>, Metadata>>

  • Type Parameters

    • Metadata = unknown

    Parameters

    • key: string
    • options: KVNamespaceGetOptions<"text">

    Returns Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>

  • Type Parameters

    • ExpectedValue = unknown
    • Metadata = unknown

    Parameters

    • key: string
    • options: KVNamespaceGetOptions<"json">

    Returns Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>

  • Type Parameters

    • Metadata = unknown

    Parameters

    • key: string
    • options: KVNamespaceGetOptions<"arrayBuffer">

    Returns Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>

  • Type Parameters

    • Metadata = unknown

    Parameters

    • key: string
    • options: KVNamespaceGetOptions<"stream">

    Returns Promise<KVNamespaceGetWithMetadataResult<ReadableStream<any>, Metadata>>

  • Type Parameters

    • Metadata = unknown

    Parameters

    • Optionaloptions: KVNamespaceListOptions

    Returns Promise<KVNamespaceListResult<Metadata, string>>

  • Parameters

    • key: string
    • value: string | ArrayBuffer | ArrayBufferView<ArrayBufferLike> | ReadableStream<any>
    • Optionaloptions: KVNamespacePutOptions

    Returns Promise<void>