Skip to main content
Home
This release is 2 versions behind 0.29.2 — the latest version of @kitsonk/kv-toolbox. Jump to latest

Built and signed on GitHub Actions

Utilities for working with Deno KV. Encrypted values, batching atomic transactions, handling blobs, querying/filtering, and more.

This package works with Node.js, Deno, Bun, Browsers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 weeks ago (0.29.0)

default

KV Toolbox

c
CryptoKvToolbox

A ToolboxKv that allows for encryption and decryption of blob values that are stored in the underlying Deno.Kv.

f
openKvToolbox

Open a ToolboxKv or CryptoToolboxKv instance for interacting with the Deno KV store.

batched_atomic

Provides the function batchedAtomic which is like Deno.Kv.prototype.atomic but will work around the per atomic transaction limits imposed by Deno KV.

I
BatchAtomicOptions

Options which can be adjusted when using a batched atomic.

f
batchedAtomic

Similar to Deno.Kv.prototype.atomic but deals with the limits of transactions imposed by Deno KV.

c
BatchedAtomicOperation

The class that encapsulates the batched atomic operations. Works around limitations imposed by Deno KV related to individual atomic operations.

blob

A set of APIs for storing arbitrarily sized blobs in Deno KV. Currently Deno KV has a limit of key values being 64k.

v
BLOB_KEY

When there are parts of a blob, this key will be set as a sub-key of the blob blob entry, which will have additional sub-keys with the parts of the blob stored as Uint8Array with a key of an incrementing number.

v
BLOB_META_KEY

If there is meta data associated with a blob entry, like for something that was originally a Blob or File, then this will be set as a sub-key of that blob key with a value of the meta data.

I
BlobBlobJSON

An interface to represent a Blob value as JSON.

I
BlobBufferJSON

An interface to represent a array buffer or typed array value as JSON.

I
BlobFileJSON

An interface to represent a File value as JSON.

T
BlobJSON

An interface to represent a blob value as JSON.

I
BlobKvListOptions

Options which can be used when calling list.

T
BlobMeta

When a blob entry was originally a Blob or File a sub-entry will be set with the value of this meta data.

f
get

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

f
getAsBlob

Retrieve a binary object from the store as a Blob or File that has been previously set.

f
getAsJSON

Retrieve a binary object from the store as an object which which be safely converted into a JSON string.

f
getAsResponse

Retrieve a blob value as a Response which is suitable for sending as a response to an HTTP request. This will read the blob out of the KV store as a stream and set information in the response based on what is available from the source.

I
GetAsResponseOptions

Options which can be used when calling getAsResponse.

f
getAsStream

Retrieve a binary object from the store as a byte ReadableStream.

f
getMeta

Retrieve a binary object's meta data from the store as a Deno.KvEntryMaybe.

f
list

Retrieve a list of keys in the database. The returned list is an Deno.KvListIterator which can be used to iterate over the blob entries in the database, returning a ReadableStream for each matching blob entry. Any other values in the database will be ignored.

f
remove

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

f
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.

f
toBlob

A convenience function which converts a string value to a Blob which can be stored via set. The function optionally takes a type which represents the media type of the string (e.g. "text/plain" or "text/html"). type defaults to "text/plain".

f
toJSON

Convert a typed array, array buffer, Blob or File into a form that can be converted into a JSON string.

f
toValue

Convert a previously encoded object into an instance of File.

crypto

APIs for dealing with encrypted Deno KV values.

c
CryptoKv

Wraps a Deno.Kv to allow encryption and decryption of the values set within the store.

I
Encryptor

An interface to supply encryption and decryption capability to CryptoKv. This allows for the ability to utilize items like key rings and other types of external encryption capabilities.

f
generateKey

Generate a new random encryption key which can be used with CryptoKv. The value returned as a hex encoded string.

T
Key

Valid data types that can be used when supplying an encryption key.

f
openCryptoKv

Open a Deno KV store and resolves with an instance of CryptoKv which can be used to deal with encrypted values.

keys

APIs for dealing with Deno KV keys.

f
equals

Determines if one Deno.KvKey equals another. This is more focused than a deeply equals comparison and compares key parts that are Uint8Array in a way that avoids potential code exploits.

f
keys

Return an array of keys that match the query.

I
KeyTree

The root node of a key query of the Deno KV store where the keys are organized into a tree structure.

f
partEquals

Determines if one Deno.KvKeyPart equals another. This is more focused than just comparison as it compares Uint8Array parts in a way that avoids potential code exploits.

f
startsWith

Determines if one Deno.KvKey matches the prefix of another.

f
tree

Query a Deno KV store for keys and resolve with any matching keys organized into a tree structure.

f
unique

Resolves with an array of unique sub keys/prefixes for the provided query.

f
uniqueCount

Resolves with an array of unique sub keys/prefixes for the provided prefix along with the number of sub keys that match that prefix. The count represents the number of sub keys, a value of 0 indicates that only the exact key exists with no sub keys.

I
UniqueCountElement

Elements of an array that gets resolved when calling uniqueCount.

query

Utilities for querying/filtering entries from a Deno.Kv instance.

c
Filter

A filter instance which can be used to filter entries based on a set of conditions. Users should use the static methods to create instances of this class.

T
Kinds

The different kinds of values that can be stored in a Deno.Kv.

I
KvFilterAndJSON

A representation of an and filter as a JSON object.

T
KvFilterJSON

A representation of a filter as a JSON object.

I
KvFilterOrJSON

A representation of an or filter as a JSON object.

I
KvFilterValueJSON

A representation of a value filter as a JSON object.

I
KvFilterWhereJSON

A representation of a where filter as a JSON object.

T
KvListSelectorJSON

A representation of a Deno.KvListSelector as a JSON object.

I
KvQueryJSON

A representation of a query as a JSON object.

T
Operation

The supported operations for filtering entries.

c
PropertyPath

A representation of a property path to a value in an object. This is used to be able to query/filter entries based on nested properties.

c
Query

Query instance for filtering entries from a Deno.Kv instance.

f
query

Query/filter entries from a Deno.Kv instance.

I
QueryLike
No documentation available
I
QueryOptions

Options which can be used when calling query.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.