UNPKG

@deno/kv

Version:

A Deno KV client library optimized for Node.js.

21 lines (20 loc) 774 B
// Copyright 2023 the Deno authors. All rights reserved. MIT license. import * as dntShim from "./_dnt.shims.js"; /** * Creates a new KvService instance that can be used to access Deno's native implementation (only works in the Deno runtime!) * * Requires the --unstable flag to `deno run` and any applicable --allow-read/allow-write/allow-net flags */ export function makeNativeService() { if ("Deno" in dntShim.dntGlobalThis) { // deno-lint-ignore no-explicit-any const { openKv } = dntShim.dntGlobalThis.Deno; if (typeof openKv === "function") { return { // deno-lint-ignore no-explicit-any openKv: openKv, }; } } throw new Error(`Global 'Deno.openKv' not found`); }