dat-folder-db
Make Dat CLI compatible databases. A database made with dat-folder-db
can be resumed with the Dat CLI.
Wrapper of level to create/resume a .dat
folder database. If there is an existing .dat
folder, it will get the key of the existing dat, allowing it to be resumed.
Use in Dat applications using node and the file system to store the database.
Usage
var datDb =
This will create a .dat
folder: my_folder/.dat
and a level
database in that folder.
See example.js
for a full example.
API
datFolder(dir, [opts], cb)
Creates a level db in the .dat
folder and checks if there is an existing key saved there.
dir
is required. This is the base path for the dat folder.cb
is called with(err, db, existingKey, saveKey)
db
is the level database indir/.dat
existingKey
is the key found in the database or null if nothing is found.saveKey
is a function to save the key back to the database.
opts
include:
opts = dbName : '.dat' // use a different name for the database
License
MIT