More info on active projects and modules at dat-ecosystem.org
read & write dat.json files. Uses toiletdb under the hood.
npm install dat-json
var DatJSON = require('dat-json')
var datjson = DatJSON(archive)
await datjson.create({title: 'a dat', description: 'exciting'})
console.log(await datjson.read())
Write to a dat.json
on the file system also:
var DatJSON = require('dat-json')
var datjson = DatJSON(archive, {file: path.join(dat.path, 'dat.json')})
await datjson.create({title: 'a dat', description: 'exciting'})
TODO: replace file option with hyperdrive indexing
create a new datJson db
Options:
opts.file
- dat.json file path, updates will be written to file system and archive
Create a new dat.json
file in the archive with the default keys (url
, title
, description
). Pass in any additional data to add on initial create.
Write a single key
and value
or an object, data
, to the dat.json
file. Use file
option above to also update the file on the file system.
Delete a key
from the dat.json
file.
Read the current dat.json
.