Need help with kv-storage-polyfill?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

144 Stars 8 Forks Other 25 Commits 4 Opened issues


A polyfill for the kv-storage built-in module.

Services available


Need anything else?

Contributors list

kv-storage polyfill

A polyfill for the kv-storage built-in module.


First, ensure you have an Import Map defined to enable the browser version where supported:

Then import the polyfill. If the browser supports

natively, it will use that instead:
import { storage } from '/node_modules/kv-storage/dist/kv-storage-polyfill.mjs';

(async () => { await storage.set("mycat", "Tom"); console.assert(await storage.get("mycat") === "Tom");

console.log(await storage.entries()); // Logs [["mycat", "Tom"]]

await storage.delete("mycat"); console.assert(await storage.get("mycat") === undefined); })();

Available Module Formats

ES Modules: (for everything)

import storage from 'kv-storage-polyfill';  // default storage namespace
import { StorageArea } from 'kv-storage-polyfill';  // instantiable StorageArea class
import storage, { StorageArea } from 'kv-storage-polyfill';  // you can combine

CommonJS: (for Node/browserify)

const storage = require('kv-storage-polyfill');  // default storage namespace
const storage = require('kv-storage-polyfill').default  // also works, just an alias
const { StorageArea } = require('kv-storage-polyfill');  // instantiable StorageArea class

UMD/AMD: (for compatibility)

define(['/web/kv-storage-polyfill.umd.js'], function(storage) {
  storage === storage.default // default storage area
  storage.StorageArea  // instantiable StorageArea class

Browser Globals: (for demos)


Apache 2

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.