https://github.com/serapath/kv-idb
minimal zero-dependencies key-value store backed by indexedDB
https://github.com/serapath/kv-idb
Last synced: about 1 year ago
JSON representation
minimal zero-dependencies key-value store backed by indexedDB
- Host: GitHub
- URL: https://github.com/serapath/kv-idb
- Owner: serapath
- License: mit
- Created: 2018-03-06T01:15:10.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-05-29T01:26:16.000Z (about 3 years ago)
- Last Synced: 2025-03-15T06:35:09.607Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://serapath.github.io/kv-idb
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kv-idb
minimal zero-dependencies key-value store backed by indexedDB
# usage
`npm install kv-idb`
```js
var kvidb = require('kv-idb')
var db = kvidb()
await db.clear(), // true
await db.put('foo', 'bar'), // true
await db.put('null', {}), // true
await db.length(), // 2
await db.keys(), // ["foo", "null"]
await db.get('foo'), // "bar"
await db.clear(), // true
await db.get('foo'), // undefined
await db.put('foo', 'bar1'), // true
await db.put('foo2', 'bar2'), // true
await db.put('foo3', 'bar3'), // true
await db.get('foo3'), // "bar3"
await db.put('foo4', null), // true
await db.get('foo4'), // null
await db.put('foo5', undefined), // true
await db.get('foo5'), // undefined
await db.get('foo'), // "bar1"
await db.get('foo3'), // "bar3"
await db.del('foo3'), // true
await db.get('foo3'), // undefined
await db.length(), // 4
await db.keys(), // ["foo", "foo2", "foo4", "foo5"]
```