0.0.1 • Published 2 years ago

@cypsela/opal v0.0.1

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

opal

name is temporary 🚧 maybe?

peer-to-peer, collaborative states using merkle-crdts.

Beta Release Tacker: https://github.com/cypsela/opal/issues/8

DALL·E 2022-09-27 21 45 51 - cabochon gemstone opal  translucent vibrant multi-color  AAA+ grade  100 carats  macro photography  kaleidoscope inside the opal

Install

npm install @cypsela/opal

Usage

import IPFS from 'ipfs'
import { Opal } from '@cypsela/opal'

/** look at js-ipfs for configurations */
const ipfs = await IPFS.create() // 

/** see more config options in the API docs */
const opal = await Opal.create({ ipfs, libp2p: ipfs.libp2p }) // ipfs.libp2p will throw a typescript error; it's a hack for now

/** create a manifest for a keyvalue database */
const manifest = await opal.determine({ name: 'this is the databases name', type: 'keyvalue' })

/** open the keyvalue database */
const keyvalue = await opal.open(manifest)

/** The keyvalue API docs are not uploaded yet */

const entryCID = await keyvalue.put('key', 'value')
const value = await keyvalue.get('key')
const entryCID = await keyvalue.del('key')

Check out the tests for more usage examples for now.

API

Check out the API Docs

License

This project is dual licensed under MIT and APACHE.

Funding

Thanks to Protocol Labs for Funding this project through a grant.