hypercore-stream

0.2.2 • Public • Published

hypercore-stream

Create a hypercore stream from a public or private key.

npm install hypercore-stream

Usage

Create stream from a secret key

var createStream = require('hypercore-stream')
var signatures = require('sodium-signatures')

var keys = signatures.keyPair()
var stream = createStream(keys.secretKey)
stream.write('hello')
stream.once('data', function (block) {
  console.log(block.toString()) // hello
})

API

var stream = createStream([key], [options])

key is either a public or private key. If it is a public key, then the stream will be readable only. If it is a private key, then the stream will be both readable and writable. If it is undefined, then a new feed is made and its public and private keys are given by stream.key and stream.secretKey.

All options are optional.

{
  db: leveldb instance,
  static: boolean,
  storage: object,
  tail: boolean,
  start: integer,
  end: integer
}

Readme

Keywords

none

Package Sidebar

Install

npm i hypercore-stream

Weekly Downloads

1

Version

0.2.2

License

MIT

Last publish

Collaborators

  • lukeburns