Git Product home page Git Product logo

dat-json's Introduction

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

dat-json's People

Contributors

joehand avatar ralphtheninja avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.