Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.03 KB

File metadata and controls

43 lines (32 loc) · 1.03 KB

hypercore-streams

Implementation of WriteStream and ReadStream for hypercore.

npm install hypercore-streams

Usage

const { WriteStream, ReadStream } = require('hypercore-streams')

const ws = new WriteStream(feed, [options])
const rs = new ReadStream(feed, [options])

Options for WriteStream:

{
  maxBlockSize: Infinity // set this to auto chunk individual blocks if they are larger than this number
}

Options for ReadStream:

{
  start: 0, // read from this index
  end: feed.length, // read until this index
  snapshot: true, // if set to false it will update `end` to `feed.length` on every read
  tail: false, // sets `start` to `feed.length`
  live: false, // set to true to keep reading forever
  timeout: 0, // timeout for each data event (0 means no timeout)
  wait: true, // wait for data to be downloaded
  batch: 1 // amount of messages to read in batch, increasing it (e.g. 100) can improve the performance reading
}

License

MIT