No-config distributed streams using hypercore
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
example.js
index.js
package.json
test.js

README.md

normcore stability

npm version build status downloads js-standard-style

No-config distributed streams using hypercore.

Usage

const normcore = require('normcore')

const feed1 = normcore('welcome-to-the-norm-zone')
const key = feed1.key.toString('hex')
feed1.append('hello')
feed1.append('this is norman')

const feed2 = normcore(key)
feed2.createReadStream().on('data', function (data) {
  console.log('feed2: ' + data.toString())
})

API

feed = normcore(keyOrNameOrPath, [opts])

Create a new normcore instance. If you pass in a hypercore hex key it will fetch that feed. If you pass it an absolute path it will create a core at that location. Otherwise it just uses the string as the local db name

opts, if specified, gets passed through as hyperdiscovery options

key = feed.key

Get the hypercore key. You probably usually want to turn it into a hex value:

const hypercore = require('hypercore')
const feed = normcore('omnormnormnormnorm')
console.log(feed.key.toString('hex'))

feed.append(data)

Write data into the feed

writeableStream = feed.createWriteableStream()

Create a new writeableStream you can write data to

readableStream = feed.createReadableStream()

Create a new readableStream you can read data from

Installation

$ npm install normcore

See Also

License

MIT