
Security News
pnpm 10.12 Introduces Global Virtual Store and Expanded Version Catalogs
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
flash-store
Advanced tools
FlashStore is a Key-Value persistent storage with easy to use ES6 Map-like API(both Async and Sync support), powered by LevelDB and TypeScript.
FlashStore is Key-Value persistent storage with easy to use ES6 Map-like API(both Async and Sync support), powered by LevelDB and TypeScript.
Try the following command
npm install
npm run demo
The basic function as follows:
import { FlashStore } from 'flash-store'
const flashStore = new FlashStore('flashstore.workdir')
await flashStore.set(1, 'a')
console.log(`key: 1, value: ${await flashStore.get(1)}`)
// Output: 'a'
await flashStore.del(1)
console.log(`key: 1, value: ${await flashStore.get(1)}`)
// Output: undefined
Backend | Flash Store | Install NPM Command |
---|---|---|
LevelDB | v1.0 | npm install flash-store@1 |
SQLite | v0.20 | npm install flash-store@0.20 |
Medea | v0.18 | |
SnapDB | v0.16 | |
RocksDB | v0.14 | npm install flash-store@0.14 |
LevelDB | v0.12 | npm install flash-store@0.12 |
SnapDB & Medea were all deprecated because of lots of unknown bugs.
FlashStore
FlashStore implements the Standard ES6 Map API with Async modification, powered by async-map-like
/**
* ES6 Map API with Async
*/
export interface AsyncMap<K = any, V = any> {
[Symbol.asyncIterator]() : AsyncIterableIterator<[K, V]>
size : Promise<number>
clear () : Promise<void>
delete (key: K) : Promise<void>
entries() : AsyncIterableIterator<[K, V]>
get (key: K) : Promise<V | undefined>
has (key: K) : Promise<boolean>
keys () : AsyncIterableIterator<K>
set (key: K, value: V) : Promise<void>
values () : AsyncIterableIterator<V>
}
class FlashStore<K, V> implements AsyncMap<K, V> {}
FlashStoreSync
FlashStoreSync implements the Standard ES6 Map API:
class FlashStoreSync<K, V> implements Map<K, V> {}
FlashStoreSync
can be expected high because it's all in memory.gte
and lte
in options
do not work property. (#4)LevelDB v7.0.0 support.
string
only in this version.DEPRECATED: Due to #79 #74 and also it is very unstable in production as my experiences. (e.g. memory leak & block event loop)
Medea is a persistent key-value storage library that runs everywhere Node runs.
"It is a pure JS implementation of leveldown and it's almost as fast." — @Raynos link
"The LevelDOWN-compatible wrapper for Medea really opens up the possibility to reuse the modules that have already been created around the LevelUP ecosystem." — @kevinswiber link
Known Issues: FlashStore 会写满磁盘的问题 #155
async function compact (store: FlashStore): Promise<void> {
await store.size
const db = (store as any).levelDb.db.db.db
await new Promise((resolve, reject) => {
db.compact((err: any) => {
if (err) {
return reject(err)
}
resolve()
})
})
}
@types/
Map
interfaceMap
-like, the difference is that FlashStore is all async.FlashStoreSync
as a in-memory Write-back Cache for Flash-StoreAdd a new class FlashStoreSync
which is a in-memory full loaded Write-back Cache for Flash-Store:
cache
, lazy writes to store
.FlashStoreSync
is the same as the ES6 Map
Init version, API is LevelDB-like.
flash-store
and memory-card
Short answer:
flash-store
is for save data to local filesystem.memory-card
is for save data to a distributed network storage, it can be serialized/deserialized safely by design.Long answer:
flash-store
and memory-card
are all built by @huan, and they are all follow the ES6 Map API.
flash-store
is using a no-sql local file database to maximum the performance, it can be used as a local database, or a local cache for whatever you want to cache from other API.
memory-card
is using a local file to store data in JSON format by default, however, it supports more distributed methods. Learn more from it's repository at here
FAQs
FlashStore is a Key-Value persistent storage with easy to use ES6 Map-like API(both Async and Sync support), powered by LevelDB and TypeScript.
The npm package flash-store receives a total of 204 weekly downloads. As such, flash-store popularity was classified as not popular.
We found that flash-store 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
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.