JSPM

hyperpubee-hyper-interface

0.1.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q50824F
  • License MIT

Create and read hypercores and hyperbees in a single corestore.

Package Exports

  • hyperpubee-hyper-interface
  • hyperpubee-hyper-interface/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hyperpubee-hyper-interface) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Hyperpubee Hyper Interface

Small interface on top of hypercore to facilitate creating and reading hypercores and hyperbees in a single corestore.

Install

npm add hyperpubee-hyper-interface

Usage

Note: this example uses random-access-memory, which you will need to install to run it.

const Corestore = require('corestore')
const ram = require('random-access-memory')
const HyperInterface = require('hyperpubee-hyper-interface')

const corestore = new Corestore(ram)

const hyperInterface = new HyperInterface(corestore)
await hyperInterface.ready()

const bee = await hyperInterface.createHyperbee('testbee')
await bee.put('myKey', 'myValue')

const readBee = await hyperInterface.readHyperbee(bee.feed.key)
const { value } = await readBee.get('myKey')
console.log(value) // 'myValue'

// Or getting the entry directly (optional version param)
const entry = await hyperInterface.getEntry({hash: bee.feed.key, location: 'myKey'})
console.log(entry) // 'myValue'

Equivalent for hypercore with hyperInterface.readHypercore and hyperInterface.createHypercore