Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

manage dat.json file via toiletdb [ DEPRECATED - More info on active projects and modules at https://dat-ecosystem.org/ ]

License

Notifications You must be signed in to change notification settings

dat-ecosystem-archive/dat-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deprecated

More info on active projects and modules at dat-ecosystem.org


dat-json

read & write dat.json files. Uses toiletdb under the hood.

npm travis standard

Install

npm install dat-json

Usage

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

API

var datjson = DatJSON(archive, [opts])

create a new datJson db

Options:

  • opts.file - dat.json file path, updates will be written to file system and archive

await datjson.create([data])

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.

await datjson.write(key, val) or await datjson.write(data)

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.

await datjson.delete(key)

Delete a key from the dat.json file.

await datjson.read()

Read the current dat.json.

License

MIT

About

manage dat.json file via toiletdb [ DEPRECATED - More info on active projects and modules at https://dat-ecosystem.org/ ]

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •