bigpipe-content

Server side bigpipe plugin to deliver static content as fast as possible.

npm install bigpipe-content
5 downloads in the last week
20 downloads in the last month

Bigpipe-content

Build
Status NPM version

Bigpipe plugin that will stream static content as fast as possible. If you need images or documents delivered from a public directory this bigpipe plugin will enable you to do just that. Note: files are not cached.

Features

  • Uses the options#public directory and it subdirectories to serve static content
  • Mime types are automatically added by the send module.
  • Will delegate requests to Bigpipe#dispatch if the uri.pathname is not found.

Installation

Bigpipe-content is released in npm and can be installed using:

npm install bigpipe-content --save

To use the plugin from Bigpipe, simply add it after Bigpipe is initialized or add it to options#plugins. bigpipe.use will execute the plugin logic. Make sure the plugin name is unique, e.g. content by default.

// Usage after initialization
var content = require('bigpipe-content')
  , Pipe = require('bigpipe');

var pipe = new Pipe(http.createServer(), {
    pages: __dirname + '/pages',
    public: __dirname + '/public'
  }).listen(8080).use(content);
// Usage through createServer options
var content = require('bigpipe-content')
  , Pipe = require('bigpipe');

var pipe = Bigpipe.createServer(8080, {
      pages: __dirname + '/pages',
      public: __dirname + '/public',
      plugins: [ content ]
    });

License

MIT

npm loves you