Socket
Socket
Sign inDemoInstall

hypercore-promisifier

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hypercore-promisifier

A Hypercore wrapper that lets you switch between callback and Promise APIs


Version published
Weekly downloads
15
decreased by-59.46%
Maintainers
1
Install size
23.8 kB
Created
Weekly downloads
 

Readme

Source

hypercore-promisifier

Test on Node.js

A wrapper that provides conversion to/from callback/promise interfaces in Hypercore and RemoteHypercore.

Installation

npm i hypercore-promisifier

Usage

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)

API

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.

License

MIT

Keywords

FAQs

Last updated on 14 Jan 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc