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

swarmcloud-sw

v0.5.1

Published

Let your viewers become your unlimitedly scalable CDN.

Downloads

34

Readme

English | 简体中文

SW P2P Engine creates a communal, distributed CDN with the latest HTML5 APIs — WebRTC to connect browsers, ServiceWorker to fulfill requests, IndexedDB to cache data, and WebCrypto to do it all securely. And it never impacts the user experience. Ever. This lightweight library uses only a small portion of spare bandwidth, imperceptible CPU, 150MB of browser cache.

Features

  • WebRTC data channels for lightweight peer-to-peer communication with no plugins
  • Support most popular static assets such as js, css, image and audio.
  • Seamlessly fallback to normal server usage if a browser doesn't support WebRTC
  • Compatible with all CDNs. No service side changes required.
  • Efficient scheduling policies to enhance the performance of P2P streaming
  • Use IP database to group up peers by ISP and regions

Browser Support

WebRTC has already been incorporated into the HTML5 standard and it is broadly deployed in modern browsers. The compatibility of SwarmCloud depends on the browser support of WebRTC, Service Worker and IndexedDB.

Compatibility|Chrome | Firefox | Mac Safari| Android Wechat/QQ | Opera | Edge | iOS Safari | IE |
:-: | :-: | :-: | :-: | :-: | :-: | :-:| :-:| :-: WebRTC | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | Service Worker | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | IndexedDB | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | SwarmCloud | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ |

Prepare

Register your Domain

Register your domain at https://oms.cdnbye.com

Secure your Site with HTTPS

Secure your site with HTTPS, if it isn't already. HTTPS is required for Service Worker, which we'll set up in the next step.

To secure your site with HTTPS, you can use Let's Encrypt for a free certificate and easy integration. See Let's Encrypt's starting instructions here to secure your site.

Host Service Worker

SwarmCloud's Service Worker is the magic sauce that powers P2P engine. Host SwarmCloud's Service Worker sw.js at the root of your domain, i.e., https://yourwebsite.com/sw.js. After an asset is cached, every device watches for future requests for that asset and automatically retrieves it from SwarmCloud's peer-to-peer network instead of the more expensive, slower origin server (over WebRTC instead of HTTP). You can customize configuration or use default one.

Basic Usage

Copy sw.js to your server and make it available at https://yourwebsite.com/sw.js.

Advanced Usage

See here

Install P2P Engine

Add P2P Engine script to the <head> element of home page. Again, you can customize configuration or use default one.

Basic Usage

Add one line of script to your website homepage index.html, this will setup p2p engine automatically with default configuration.

<head>
    <script src="https://cdn.jsdelivr.net/npm/swarmcloud-sw@latest?auto=true"></script>
    ...
</head>

Note that the script parameter must be "auto = true".

Advanced Usage

See here

Check if SwarmCloud works correctly

Open Chrome Console, if it prints like "ServiceWorker registration successful with scope", that means SwarmCloud is already working.

API and Configuration

See API.md

Open Source Sponsorship

All non-profit sites such as open source projects and blogs can apply for permanent free use, please contact customer service to activate.

Related Projects

FAQ

We have collected some frequently asked questions. Before reporting an issue, please search if the FAQ has the answer to your problem.

Contact Us

Email: [email protected] Telegram: @cdnbye Skype: live:86755838