
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
storage-kv
Advanced tools
Node.js client for Cloudflare's KV Storage: a global, highly distributed, low-latency, key-value data store.
Node.js client for Cloudflare's KV Storage: a global, highly distributed, low-latency, key-value data store.
Workers KV is a highly distributed, eventually consistent, key-value store that spans Cloudflare's global edge. It allows you to store billions of key-value pairs and read them with ultra-low latency anywhere in the world. Now you can build entire applications with the performance of a CDN static cache.
This project follows the std:kv-storage specs.
⚠️ Early preview release (0.0.7) - Don't use in production.
yarn add storage-kv
const { StorageArea } = require("storage-kv");
Creates a new StorageArea that provides an async key/value store view onto a Cloudflare KV namespace.
const storage = new StorageArea("cats");
This does not actually fetch or create the namespace yet; that is done lazily when other methods are called. This means that all other methods can reject with namespace-related exceptions in failure cases.
You can specify in the options the path to Cloudflare credentials file:
const storage = new StorageArea("cats", {
keyFilename: "/path/to/keyFilename.json"
});
or passing the credentials directly
const storage = new StorageArea("cats", { credentials: { id, email, key } });
If none is given it will look for credential CF_KEY, CF_ID, CF_EMAIL or CF_KEYFILENAME in global env, falling back to "./cf-credentials.json".
Asynchronously stores the given value so that it can later be retrieved by the given key.
Values types are automatically inferred and can be of type [String, ReadableStream, ArrayBuffer, FormData].
The returned promise will fulfill with undefined on success.
await storage.set("one-cat", "birman");
Keys can be set to expire:
exp: seconds since epochttl: seconds from nowawait storage.set("one-cat", "birman", { exp: 1558853089 });
await storage.set("another-cat", "merican curl", { ttl: 60 });
Asynchronously retrieves the value stored at the given key, or undefined if there is no value stored at key.
const cat = await storage.get("one-cat");
console.assert(cat === "birman");
Asynchronously deletes the entry at the given key.
This is equivalent to storage.set(key, undefined).
The returned promise will fulfill with undefined on success.
await storage.delete("one-cat");
Asynchronously deletes all entries in this storage area. This is done by actually deleting the underlying namespace. The returned promise will fulfill with undefined on success.
await storage.clear();
Retrieves an async iterator containing the keys of all entries in this storage area. Keys will be yielded in ascending order;
for await (const key of storage.keys()) {
console.log(key);
}
// "one-cat"
// "another-cat"
Retrieves an async iterator containing the values of all entries in this storage area.
Values will be ordered as corresponding to their keys; see keys().
for await (const value of storage.values()) {
console.log(value);
}
// "birman"
// "american curl"
Retrieves an async iterator containing the [key, value] of all entries in this storage area.
Entries will be ordered as corresponding to their keys; see keys().
for await (const [key, value] of storage.entries()) {
console.log(key, value);
}
// "one-cat", "birman"
// "another-cat", "american curl"
FAQs
Node.js client for Cloudflare's KV Storage: a global, highly distributed, low-latency, key-value data store.
The npm package storage-kv receives a total of 368 weekly downloads. As such, storage-kv popularity was classified as not popular.
We found that storage-kv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.