Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

StorageArea

import { StorageArea } from "https://raw.githubusercontent.com/worker-tools/cloudflare-kv-storage/master/index.ts";

An implementation of the StorageArea interface wrapping Cloudflare Worker's KV store.

The goal of this class is ease of use and compatibility with other Storage Area implementations, such as https://github.com/GoogleChromeLabs/kv-storage-polyfill.

While work on the specification itself has stopped, it's still a good interface for asynchronous data access that feels native to JavaScript.

Note that efficiency is not a goal. Specifically, if you have sizable ArrayBuffers, it's much better to use Cloudflare's KV directly.

class StorageArea implements StorageArea {
constructor(name?: string, opts?: KVOptions);
constructor(name?: KVNamespace, opts?: Omit<KVOptions, "namespace">);
constructor(name?: string | KVNamespace, options?: KVOptions);
backingStore();
async clear(opts?: KVListOptions);
delete(key: AllowedKey);
async *entries<T>(opts?: KVListOptions): AsyncGenerator<[Key, T]>;
get<T>(key: AllowedKey, opts?: unknown): Promise<T>;
async *keys(opts?: KVListOptions): AsyncGenerator<Key>;
async set<T>(
value: T | undefined,
opts?: KVPutOptions,
): Promise<void>;
async *values<T>(opts?: KVListOptions): AsyncGenerator<T>;
 
static defaultKVNamespace?: KVNamespace;
}

§Implements

§Constructors

§
new StorageArea(name?: string, opts?: KVOptions)
[src]
§
new StorageArea(name?: KVNamespace, opts?: Omit<KVOptions, "namespace">)
[src]
§
new StorageArea(name?: string | KVNamespace, options?: KVOptions)
[src]

§Methods

§
backingStore()
[src]
§
clear(opts?: KVListOptions)
[src]
§
delete(key: AllowedKey)
[src]
§
entries<T>(opts?: KVListOptions): AsyncGenerator<[Key, T]>
[src]
§
get<T>(key: AllowedKey, opts?: unknown): Promise<T>
[src]
§
keys(opts?: KVListOptions): AsyncGenerator<Key>
[src]
§
set<T>(key: AllowedKey, value: T | undefined, opts?: KVPutOptions): Promise<void>
[src]
§
values<T>(opts?: KVListOptions): AsyncGenerator<T>
[src]

§Static Properties

§
defaultKVNamespace: KVNamespace
[src]