A small command-line helper for storing and retrieving key–value pairs through the keyval.org API.
- Node.js (recommended: current LTS or newer)
You can run keyval CLI in two ways.
This is the recommended approach: use npx so you do not install a global module. npm fetches and runs the CLI when you need it.
Set a value
npx keyval set <key> <value>Get a value
npx keyval get <key>Example (suggest using a key at least 10 characters long):
npx keyval set my-10-plus-char-key "hello world"
npx keyval get my-10-plus-char-keyInstall the package once, then run keyval directly (no npx):
npm i -g keyval
keyval set <key> <value>
keyval get <key>The CLI prints a success summary for set, and prints the stored value line for get. If something goes wrong, you’ll see an error message on stderr and a non-zero exit code.
Caching, an unpublished local version, or an older npm can sometimes give you stale or unexpected behavior. Pin the registry package explicitly:
npx keyval@latest set <key> <value>
npx keyval@latest get <key>- Website and service: keyval.org
This package exposes default { set, get } from index.js, so you can also import kv from 'keyval' in your own Node projects when you depend on keyval as an npm dependency.
npm install keyval
----
import kv from "keyval";
const s = await kv.set("hello-from-keyval-org", "hello-there");
const v = await kv.get("hello-from-keyval-org");
console.log(v);
OR
async function main() {
const s = await kv.set("hello-from-keyval-org", "hello-there");
const v = await kv.get("hello-from-keyval-org");
console.log(v);
}
main();
Please open a ticket for any bugs or updates at https://github.com/prakis/keyval/issues