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

slugboot

v1.1.0

Published

aggressively cache at the application layer for offline-only webapps

Downloads

12

Readme

slugboot

aggressively cache at the application layer for offline-only webapps

With this module serving as a kind of web bios, you can create identical "slug" domains (with https certs) that can be flashed with any application. The application payload is stored in indexedDB.

This way, you can load webapps from p2p networks over webrtc, bluetooth LE, or acoustic couplers. The webapps stay saved on your computer and you can open them on a slug domain whenever you wish.

example

create a main.js file:

var slug = require('slugboot')('/worker.js')
slug.version(function (err, v) {
  if (err) return console.error(err)
  if (v) return console.log('already uploaded a version')

  slug.fetch('/')
  slug.fetch('/bundle.js')
  slug.fetch('/worker.js')
  slug.put('/hello.txt', 'HI THERE')
  slug.commit(function (err) {
    if (err) return console.error(err)
    else console.log('uploaded version')
  })
})

window.slug = slug

set up public/ with the slugboot worker.js file:

$ npm i -g browserify ecstatic
$ mkdir public
$ echo '<script src="bundle.js"></script>' > public/index.html
$ cp `node -pe "require.resolve('slugboot/worker.js')"` public/
$ browserify main.js > public/bundle.js
$ ecstatic -p 44000 public/

Now open http://localhost:44000 and poke around with the slug instance on the REPL.

api

var slugboot = require('slugboot')

var slug = slugboot(workerURL)

Create a new slugboot instance from a workerURL path string to the slugboot service worker code.

slug.put(path, body, cb)

Stage a string body to be saved at the path string path.

cb(err) fires with any errors.

slug.fetch(src, dst, cb)

Request the document at the url string src and save the result to the path at dst.

If dst is not given, it will use the pathname of src.

cb(err) fires with any errors.

slug.copy(src, dst, cb)

Copy the file path src from the current active version to dst in the staging version.

cb(err) fires with any errors.

slug.commit(cb)

Commit any staged changes and increment the version.

cb(err) fires with any errors.

slug.version(cb)

Query for the integer version as cb(err, version).

Before flashing, the version will be undefined.

The first version after a commit is version 1.

install

npm install slugboot

license

BSD