1.0.0 • Published 2 years ago

fastkv v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

FastKV

FastKV is a key-value store which offers the following features:

  • Supports temporary in-memory storage 🕒
  • Supports persistent storage with JSON files 📁
  • Lightweight with no dependencies ⚡

Installation

Get FastKV via npm using your favourite package manager:

npm install fastkv
# or
yarn add fastkv
# or
pnpm add fastkv

Example

import { KV } from 'fastkv';

// For TypeScript users, the KV supports generics:
// const example = new KV<string>();
// Or: example.get<string>('my-key-name');

const kv = new KV('./db.json'); // Save the data. Path resolves with process.cwd()
const cache = new KV('::memory::'); // Keep the data in the system's memory.

// Set data
kv.set('userSettings', { theme: 'dark' }); // -> KV

// Retreive data by a key
kv.get('userSettings'); // -> { theme: 'dark' }

// Retreive all data
kv.all(); // -> [{ key: 'userSettings', value: { theme: 'dark' } }]

// Clear the store
kv.clear(); // -> KV
1.0.0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.0

2 years ago