1.0.0 • Published 3 years ago
gun-leveldb v1.0.0
LevelDB Adapter for GunDB
Usage
First install gun-leveldb and gun
npm install gun gun-leveldb
Then import the gun-leveldb package before initialising a Gun instance. This will make the LevelDB adapter available for gun.
var Gun = require("gun");
require("gun-leveldb");
const gun = Gun({
// Options explained later
});
To initialise the Database there are several options.
- Use mainly defaults:
{ levelDB: true }
- Specify a folder for the LevelDB:
{ levelDB: "./database-folder" }
- Give it a custom levelup instance
{ levelDB: yourLevelUpinstance }
The adapter used the v8 serialisation and deserialisation since it is rather fast and can directly work with arraybuffers.
If there is no data already written to the database, this can be changed by setting: { levelDBJSON: true }
wich will force JSON encoding.
1.0.0
3 years ago