Registry / storage / storage-kv

storage-kv

JSON →
library0.0.9jsnpmunverified

Node.js client for Cloudflare's KV Storage, a globally distributed key-value store with low-latency reads and writes. Version 0.0.9 is the latest; development is active but early. Differentiates by being a community-maintained SDK specifically for Cloudflare KV, unlike the official Workers KV client which is edge-only. Provides both Promise and async/await APIs. Supports bulk operations and TTLs. Not suitable for high-throughput production use yet.

npm install storage-kv
INSTALL
IMPORT
SIG · STORAGE-KV
S
storage-kv
storagejavascriptv0.0.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

KVClient
import { KVClient } from 'storage-kv'
const KVClient = require('storage-kv')
Named export only; no default export.
KV
import { KV } from 'storage-kv'
import KV from 'storage-kv'
Use named import for the KV class.

Demonstrates instantiation with Cloudflare credentials and basic CRUD operations (put, get, delete) with optional TTL.

import { KV } from 'storage-kv'; const client = new KV({ accountId: process.env.CF_ACCOUNT_ID ?? '', namespaceId: process.env.CF_NAMESPACE_ID ?? '', apiToken: process.env.CF_API_TOKEN ?? '' }); async function main() { await client.put('key', 'value', { expirationTtl: 3600 }); const value = await client.get('key'); console.log(value); const deleted = await client.delete('key'); console.log('Deleted:', deleted); } main().catch(console.error);
Debug
Known issues
gotchaNamespace ID is required but not validated; incorrect ID causes silent failures.
fix
Double-check namespace ID from Cloudflare dashboard; use environment variables.
affects: >=0.0.0
gotchaThe library does not handle pagination for list operations; only returns first page.
fix
Manually implement pagination using the cursor from list responses.
affects: 0.0.9
deprecatedThe 'KVClient' class is deprecated in favor of 'KV' since version 0.0.8.
fix
Use 'KV' class instead.
affects: >=0.0.8
gotchaValues are limited to 25 MB; larger values will cause hard failures.
fix
Split large payloads into chunks or use alternative storage.
affects: >=0.0.0
breakingVersion 0.0.7 changed constructor signature from (options) to (accountId, namespaceId, apiToken).
fix
Update instantiation to positional arguments.
affects: 0.0.7
Errors
Common errors & fixes
Error: Invalid namespace id
Namespace ID is not a valid UUID or does not exist in account.
fix
Verify namespace ID in Cloudflare dashboard and ensure correct accountId.
TypeError: client.get is not a function
Using deprecated KVClient class that does not have get method.
fix
Switch to KV class: import { KV } from 'storage-kv'.
Error: 10007: API token is not valid
API token lacks permissions for KV storage or is expired.
fix
Generate a token with 'Workers KV Storage' edit permissions; set CF_API_TOKEN env var.
Upgrade
Version history
0.0.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
26 hits · last 30 days
node
22
Amazon
1
OpenAI (training)
1
Resources
storage-kv — npm install storage-kv · libregistry