Kind: global class
Promise.<void>Promise.<(V\|null)>Promise.<void>AsyncIterableIterator.<K>AsyncIterableIterator.<V>Promise.<number>Promise.<void>FlashStore is a Key-Value database tool and makes using leveldb more easy for Node.js
Creates an instance of FlashStore.
| Param | Type | Default |
|---|---|---|
| [workdir] | string |
"path.join(appRoot, 'flash-store.workdir')" |
Example
import { FlashStore } from 'flash-store'
const flashStore = new FlashStore('flashstore.workdir')
Promise.<void>Put data in database
Kind: instance method of FlashStore
| Param | Type |
|---|---|
| key | K |
| value | V |
Example
await flashStore.put(1, 1)
Promise.<(V\|null)>Get value from database by key
Kind: instance method of FlashStore
| Param | Type |
|---|---|
| key | K |
Example
console.log(await flashStore.get(1))
Promise.<void>Del data by key
Kind: instance method of FlashStore
| Param | Type |
|---|---|
| key | K |
Example
await flashStore.del(1)
AsyncIterableIterator.<K>Find keys by IteratorOptions
Kind: instance method of FlashStore
| Param | Type | Default |
|---|---|---|
| [options] | IteratorOptions |
{} |
Example
const flashStore = new FlashStore('flashstore.workdir')
for await(const key of flashStore.keys({gte: 1})) {
console.log(key)
}
AsyncIterableIterator.<V>Find all values
Kind: instance method of FlashStore
Example
const flashStore = new FlashStore('flashstore.workdir')
for await(const value of flashStore.values()) {
console.log(value)
}
Promise.<number>Get the counts of the database
Kind: instance method of FlashStore
Example
const count = await flashStore.count()
console.log(`database count: ${count}`)
Promise.<void>Destroy the database
Kind: instance method of FlashStore
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| gt | any |
Matches values that are greater than a specified value |
| gte | any |
Matches values that are greater than or equal to a specified value. |
| lt | any |
Matches values that are less than a specified value. |
| lte | any |
Matches values that are less than or equal to a specified value. |
| reverse | boolean |
Reverse the result set |
| limit | number |
Limits the number in the result set. |
| prefix | any |
Make the same prefix key get together. |