Skip to content

DistributedWeb/dwebx-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dwebx-json

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

npm travis standard

Install

npm install dwebx-json

Usage

var DWebxJSON = require('dwebx-json')

var dwebxjson = DWebxJSON(archive)

dwebxjson.create({title: 'a dwebx', description: 'exciting'}, function (err) {
  if (err) throw err
})

dwebxjson.read(function (err, data) {
  console.log(data)
})

Write to a dwebx.json on the file system also:

var DWebxJSON = require('dwebx-json')

var dwebxjson = DWebxJSON(archive, {file: path.join(dwebx.path, 'dwebx.json')})

dwebxjson.create({title: 'a dwebx', description: 'exciting'}, function (err) {
  if (err) throw err
})

TODO: replace file option with ddrive indexing

API

var dwebxjson = DWebxJSON(archive, [opts])

create a new dwebxJson db

Options:

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

dwebxjson.create([data], cb)

Create a new dwebx.json file in the archive with the default keys (url, title, description). Pass in any additional data to add on initial create.

dwebxjson.write(key, val, cb) or dwebxjson.write(data, cb)

Write a single key and value or an object, data, to the dwebx.json file. Use file option above to also update the file on the file system.

dwebxjson.delete(key, cb)

Delete a key from the dwebx.json file.

dwebxjson.read(cb)

Read the current dwebx.json.

License

MIT

About

DEPRECATED LEGACY DWEB MODULE

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •