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 🙏

© 2026 – Pkg Stats / Ryan Hefner

peer-connect-client

v0.1.94

Published

<h1 align="center"> <a href="https://github.com/PeerConnect/PeerConnect"> <img src="https://justinko43.github.io/03_300%20DPI.png"> </a> <br> PeerConnect <br> </h1>

Readme

About

PeerConnect is a proof of concept that aims to serve static assets (videos/images) over a peer to peer delivery network powered by WebRTC (images), WebTorrent (videos), and WebSockets (signaling)

Images

PeerConnect uses WebRTC for image P2P transfers. By using websockets, we are able to coordinate data-channel connections between two different peers. If no available peers are present, images are loaded from the server. Once a peer finishes downloading, they become an initiator for future P2P data transfers.

Video

PeerConnect uses WebTorrent and torrenting protocols for video P2P transfers. By utilizing the server as a webseed for videos, as more and more individuals visit the site, video streams will get progressively stronger and rely less on the initial webseed hosted on the server.

Usage

Using PeerConnect requires a script on the client end and initiation on the server.

Setup

Client

If using a file bundler e.g. (browserify), you can require it in your script file.

const PeerConnectClient = require('peer-connect-client');
PeerConnectClient();

If you want to use the module without bundling, it is currently being hosted on unpkg CDN. Use it as a script in your html file.

https://unpkg.com/[email protected]/peer-connect-client.min.js

You will need to bring in socket.io as a script in your html file.

<script src="/socket.io/socket.io.js"></script>

Server

PeerConnect utilizes Express and socket.io to coordinate WebRTC connections. In addition, in order to create webseeds, we create routes serving the video files.

To use it, require PeerConnectServer from our package and pass in the Node Server instance you're using along with your PeerConnectServer configurations. In Express, you can get this instance by calling app.listen.

Here's how you would use it in your server:

const PeerConnectServer = require('peer-connect-server');
const server = app.listen(8000);
PeerConnectServer(server, app, [opts]);

Example

Set src attributes in a data-src attribute for assets!

<video data-src="../assets/videos/yosemite-hd.mp4" controls src=""></video>
  <div class="image-container-inner">
    <img data-src="../assets/image1.jpg">
    <img data-src="../assets/image2.png">
  </div>

Configuration

It's easy to incorporate PeerConnectServer. Just provide us with a few details on your peerConfig object and we'll do the rest! If opts is specified to PeerConnectServer, it will override the default options (shown below).

threshold - An integer threshold value to determine when to turn on P2P image sharing e.g. if threshold = 3, fourth client will load from peers peerImages - A boolean that determines whether to load images P2P peerVideos - A boolean that determines whether to load videos P2P excludeFormats - An array of string(s) that say which file formats to exclude from peers foldLoading - A boolean that determines whether to load images above the fold from the server if true geoLocate - A boolean that either uses geolocation to pair the closest peers or not videoRoute - The path to all of your video assets torrentRoute - The path where a new folder holding all of your torrent files will be created domainName - Your website url

{
  threshold: Integer             // 3
  peerImages: Boolean            // true
  peerVideos: Boolean            // true
  excludeFormats: [Strings]      // ['gif']
  foldLoading: Boolean           // false
  geoLocate: Boolean             // true
  videoRoute: String             // './assets/videos'
  torrentRoute: String           // './assets'
  domainName: String             // 'https://peerconnect.io'
}

Contributing

To contribute to PeerConnect, fork the repository and clone it to your machine then install dependencies with npm install. If you're interested in joining the Peer Connect team as a contributor, feel free to message one of us directly!

Authors

  • Justin Ko (https://github.com/justinko43)
  • Mike Gutierrez (https://github.com/mikegutierrez)
  • Peter Lee (https://github.com/wasafune)
  • Jim Kang (https://github.com/jiminykbob)

License

This project is licensed under the MIT License - see the LICENSE file for details