A Hypercore wrapper that lets you switch between callback and Promise APIs
MIT License
A wrapper that provides conversion to/from callback/promise interfaces in Hypercore and RemoteHypercore.
npm i hypercore-promisifier
const hypercore = require('hypercore')
const ram = require('random-access-memory')
const { toPromises } = require('hypercore-promisifier')
const core = hypercore(ram)
// A promisified Hypercore interface
const wrapper = toPromises(core)
The API supports two methods, each one returning a compatibilty wrapper around Hypercore.
const { toCallbacks, toPromises, unwrap } = require('hypercore-promisifier')
toCallbacks(core)
takes a Hypercore-like object with a Promises API, and returns a wrapper with a
callbacks interfaced.
toPromises(core)
takes a Hypercore-like object with a callbacks API, and returns a wrapper with a
Promises interface.
unwrap(core)
takes either a wrapper object, or a normal Hypercore, and returns a normal (callbacks API) Hypercore.
MIT