FlashStore is Key-Value persistent storage with easy to use ES6 Map-like API(both Async and Sync support), powered by LevelDB and TypeScript.
- Node.js v10 or above
Try the following command
npm installnpm run demo
The basic function as follows:
await flashStore.set1, 'a'console.log`key: 1, value: `// Output: 'a'await flashStore.del1console.log`key: 1, value: `// Output: undefined
|Backend||Flash Store||Install NPM Command|
SnapDB & Medea were all deprecated because of lots of unknown bugs.
FlashStore implements the Standard ES6 Map API with Async modification, powered by async-map-like
/*** ES6 Map API with Async*/
FlashStoreSync implements the Standard ES6 Map API:
- You get a sync API at the cost of all your data have to be kept in memory.
- The data will be async writing back to disk for persistent storage in background.
- The performance of
FlashStoreSynccan be expected high because it's all in memory.
- Node.js databases: an embedded database using LevelDB
- How to Cook a Graph Database in a Night - LevelGraph
- Graph database JS style for Node.js and the Browser. Built upon LevelUp and LevelDB.
- 浅析 BigTable 和 LevelDB 的实现
optionsdo not work property. (#4)
v0.20 Apr 2020 SQLite as Backend
- We hardcoded the key type to be
stringonly in this version.
- We decide to try better-sqlite3 as it claim is very fast.
- The other alternates (would love to try in the future if necessary):
v0.18 Feb 2019 - Medea as Backend
- Switch from SnapDB to MedeaDown
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
v0.16 May 2019 - SnapDB as Backend
- Switch from RocksDB to SnapDB #45
- #50 has been fixed.
WARN: Do not use this version because it has known issues
v0.14 May 2019 - RocksDB as Backend
v0.12 Jan 2019 - LevelDB as Backend
- Use LevelDB as backend to skip the compiling when install.
- Using leveldb official typings from
v0.7 Aug 2018 - Nosql-LevelDB as Backend
- Use nosql-leveldb as backend to prevent segfault.
v0.6 Jul 2018
- Upgrade to TypeScript 3.0
v0.4 Jun 2018
1. Refactor API to implement ES6
- Update the API to ES6
Map-like, the difference is that FlashStore is all async.
FlashStoreSync as a in-memory Write-back Cache for Flash-Store
Add a new class
FlashStoreSync which is a in-memory full loaded Write-back Cache for Flash-Store:
- Writes directly to
cache, lazy writes to
- Reads from cache, never read-miss because cache have the full data of the store which will never expire.
- API of
FlashStoreSyncis the same as the ES6
v0.2 Sep 2017
Init version, API is LevelDB-like.
Q: What's the difference between the
flash-storeis for save data to local filesystem.
memory-cardis for save data to a distributed network storage, it can be serialized/deserialized safely by design.
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 catch from a network database.
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
Copyright & License
- Code & Docs © 2017-now Huan (李卓桓) <email@example.com>
- Code released under the Apache-2.0 License
- Docs released under Creative Commons