npm.io
1.0.0 • Published 6 years ago

hypercore-session

Licence
MIT
Version
1.0.0
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
4

hypercore-session

Make a session from a Hypercore that can auto cancel all inflight requests / downloads.

npm install hypercore-session

Usage

const HypercoreSession = require('hypercore-session')

const session = new HypercoreSession(feed)

// get a block
const block = await session.get(42)

// get a bunch of blocks
await session.download({ start: 0, end: 42 })

// cancel all currently inflight
session.cancel()

License

MIT