npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hyperkafka

v0.1.2

Published

decentralized, interplanetary messaging platform

Downloads

6

Readme

hyperkafka

stability-experimental NPM Version JavaScript Style Guide

A decentralized messaging platform.

npm i hyperkafka

Usage

// producer
var drive = hyperdrive(memdb())
var archive = drive.createArchive()

var producer = hyperkafka.Producer(archive)
producer.write('topic', 'hello')


// somewhere, another machine
var archive2 = drive.createArchive(archive.key)
var consumer = hyperkafka.Consumer(archive2)
consumer.get('topic', 0, function (err, msg) {
  // msg === {offset: 0, ts: timestamp, payload: 'hello'}
})

// create a readable stream
var rs = consumer.createReadStream('topic')
rs.on('data', msg => { })

API

Producer

p = new Producer(archive)

Create a new Producer with a hyperdrive archive.

p.write(topic, message, [timestamp])

Append a message to a topic. message can be Buffer, String, or object.

You can specify timestamp for the message. The timestamp should be a uint64be buffer because there's no int64 support in javascript. By default it will be current time (Date.now()).

Consumer

c = new Consumer(archive)

Create a new Consumer with a hyperdrive archive.

c.get(topic, offset, cb(err, message))

Get a message on a topic with specified offset. Returns error if there's no message with given offset.

c.createReadStream(topic, start)

Get a readable stream with all messages in a topic after given offset.

FAQ

This is just append-only log! Why not just use hypercore?

Overhead, batching, and topic.

If we simply push every single message as a seperated block into hypercore. The overhead is big: 144 bytes per message for 100000 messages. Therefore we need batching.

Also we need random-accessable message within a topic. We combine hyperdrive's built-in index and kafka storage format to achieve it.

This is basic messaging! How about MQTT/RabbitMQ/ZeroMQ...or any other message queue?

Message queues usually don't preserve message history. I want a messaging platform which can automatically archive all message in a decentralized environment.

Should I replace my apache kafka cluster with hyperkafka?

No. They have different goal and use cases. hyperkafka use the name because its internal storage is inspired by apache kafka, also it sounds cool.

If you want a private, highly-scalable messaging platform, use apache kafka.

If you want to store and share public realtime data, try hyperkafka. You might like it.

License

The MIT License