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

connect-appcache-proxy

v0.1.1

Published

A proxy for files listed in an appcache manifest.

Downloads

4

Readme

connect-appcache-proxy Build Status Dependency Status

A proxy for files listed in an HTML5 appcache manifest.

Why?

When a website is served over SSL, loading resources from a different domain into the appcache is not allowed, even if these resources are served over SSL.

If you want to be able to deploy static assets quickly via Amazon S3 or similar, while still being able to use HTML5 Appcache and SSL at the same time, this module might come in handy.

Usage

var connect = require("connect")
var AppcacheProxy = require("connect-appcache-proxy")

var app = connect()
app.use(new AppcacheProxy("http://youraccount.staticfilehost.com/appcache.manifest"))

Refreshing the cache

You can call proxy.refresh(cb) to refetch the manifest and repopulate the cache from its source at any time. The new cache will be activated as soon as its entirely ready, ensuring the set of resources served are of the same release.

var app = connect()
var proxy = new AppcacheProxy("https://secure.staticfileserver.com/youraccount/appcache.manifest")
app.use(proxy))
proxy.refresh (function(err) {
  if (err) {
    console.error("Appcache proxy failed to initialize.")
    console.error(err)
    // perhaps use some retry strategy
  }
  else console.log("Appcache proxy is ready.")
})

Options

You may pass the AppCacheProxy constructor an options object as second argument. Possible options are:

  • log - a log function. Defaults to a noop. Can be handy to see what's going on.
  • overrideEntries - an object with key-value pairs with key the cache entry you want to override, and value the url you want to override it with. This is handy when you want to put /, ./ or similar entries into your manifest but your static file host does not allow specifying a resource for such an url.
  • callback - if autostart is true, this is called when the cache has finished initializing. Only at this moment is your server ready to serve requests for the files in the manifest. Defaults to throwing an error, if any.
  • autostart - will automatically populate the cache when the constructor is called. Defaults to true.
  • allowHeaders - the headers that are copied verbatim from the response received from the static file host. Defaults to ["cache-control", "content-type", "content-encoding", "content-length", "last-modified"]
  • busyMessage - when showBusy is true, then you may specify the text/plain content that is served. Defaults to "The server is restarting. Try again in a minute."
  • showBusy - when the cache is being populated, there's a brief time in which your server is not able to serve requests. This only happens once on server startup. If set to true, then a 503: Server is busy response will be served. If set to false, then any request is simply passed on to the next middleware. This in turn would most likely return in a 404 in the end, unless you serversome kind of fallback resources elsewhere.

Credits

The initial structure of this module was generated by Jumpstart, using the Jumpstart Black Coffee template.

License

connect-appcache-proxy is released under the MIT License.
Copyright (c) 2013 Meryn Stol