Skip to main content
Module

x/kv_toolbox/blob.ts

Utilities for working with Deno KV 🦕🗝️
Go to Latest
import * as kvToolbox from "https://deno.land/x/kv_toolbox@0.10.0/blob.ts";

A set of APIs for storing arbitrarily sized blobs in Deno KV. Currently Deno KV has a limit of key values being 64k. The set function breaks down a blob into chunks and manages sub-keys to store the complete value. The get function reverses that process, and remove function will delete the key, sub-keys and values.

Example

import { get, remove, set } from "jsr:@kitsonk/kv-toolbox/blob";

const kv = await Deno.openKv();
const data = new TextEncoder().encode("hello deno!");
await set(kv, ["hello"], data);
const ab = await get(kv, ["hello"]);
// do something with ab
await remove(kv, ["hello"]);
await kv.close();

Functions

Retrieve a binary object from the store with a given key that has been set.

Remove/delete a binary object from the store with a given key that has been set.

Set the blob value in the provided Deno.Kv with the provided key. The blob can be any array buffer like structure, a byte ReadableStream, or a Blob.