dweb-json
read & write dweb.json files. Uses toiletdb under the hood.
Install
npm install dweb-json
Usage
var DatJSON = var datjson = datjson datjson
Write to a dweb.json
on the file system also:
var DatJSON = var datjson = datjson
TODO: replace file option with dwebfs indexing
API
var datjson = DatJSON(archive, [opts])
create a new datJson db
Options:
opts.file
- dweb.json file path, updates will be written to file system and archive
datjson.create([data], cb)
Create a new dweb.json
file in the archive with the default keys (url
, title
, description
). Pass in any additional data to add on initial create.
datjson.write(key, val, cb)
or datjson.write(data, cb)
Write a single key
and value
or an object, data
, to the dweb.json
file. Use file
option above to also update the file on the file system.
datjson.delete(key, cb)
Delete a key
from the dweb.json
file.
datjson.read(cb)
Read the current dweb.json
.