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

protozor

v0.1.0

Published

A P2P system for replicating streaming signed append-only logs

Downloads

2

Readme

Protozor

A P2P system for replicating streaming signed append-only logs.

A Protozor feed is an append-only log where the ID is a public key and all updates must be signed by the corresponding private key. When a log is updated, a pointer to the new head of the log is broadcast over the BitTorrent network using BEP 44 mutable values. The contents of the log are replicated using hypercore, which means that the contents of a log can be downloaded in any order.

Example

See the examples directory for these scripts. The code below should work as-is; you can type into the writing side, and the text will come out the reading side, even if they're running on separate computers. To see what's happening under the hood, set the DEBUG environment variable.

Writing

The example below makes a new Protozor feed and writes stdin to it, line by line. It prints out the feed ID, which is needed to read from the feed.

var Bep44Protozor = require('protozor').bep44
var split = require('split')

var bg = Bep44Protozor()

bg.server.listen(function () {
  var feedInfo = bg.new()
  var stream = bg.createWriteStream(feedInfo)

  console.log('Protozor feed ID is', feedInfo.keypair.publicKey.toString('hex'))
  process.stdin.pipe(split()).pipe(stream)
})

Reading

The example below reads data from the Protozor feed specified as the argument, and prints it out to stdout.

var Bep44Protozor = require('protozor').bep44
var split = require('split')

var bg = Bep44Protozor()

bg.server.listen(function () {
  var feedInfo = bg.new()
  var stream = bg.createWriteStream(feedInfo)

  console.log('Protozor feed ID is', feedInfo.keypair.publicKey.toString('hex'))
  process.stdin.pipe(split()).pipe(stream)
})

Status

This code works for me, but it's still in an alpha stage. It doesn't handle any kind of firewall or NAT traversal.

API

protozor.bep44

This module makes "batteries-included" Protozor feeds, where feed updates are exchanged using BEP 44 mutable values. This includes "all the fixins:" key generation, a server for hypercore, and discovery using discovery-channel.

Bep44Protozor() - create a new Bep44Protozor object.

Bep44Protozor.new() - create a new feed. Returns a feedInfo, i.e. a keypair and a corresponding WriteFeed. Note that a Protozor feed is not the same as a hypercore feed -- a Protozor feed is a dynamically updateable pointer that refers to hypercore feeds.

Bep44Protozor.apply(feedInfo, cb) - apply the writes from the given WriteFeed, and broadcast the new head of the feed out to the network.

Bep44Protozor.get(pubkey) - return a new ReadFeed for the given pubkey, and request the head of that feed via BEP 44.

Bep44Protozor.createWriteStream(feedInfo) - return a writable stream that will write to the feed specified.

Bep44Protozor.createReadStream(feed) - given a ReadFeed, return a readable stream that reads from the feed. Note that this stream never ends.

Bep44Protozor.destroy() - this must be called to release the resources from the object

protozor.protozor

The core functionality for updateable hypercore feeds. This doesn't include any network logic or key verification logic.

protozor.hypercore-server

Convenience functions for making a hypercore server, including discovery.

protozor.torrent-kv

A simple interface for dealing with BEP 44 mutable values.