GridFS file server for Connect
JavaScript
Latest commit a2278e8 Mar 30, 2014 @baryshev Fix typo
Permalink
Failed to load latest commit information.
lib Fix typo Mar 30, 2014
.npmignore First commit Jan 27, 2013
LICENSE First commit Jan 27, 2013
README.md Update README.md Jan 27, 2013
index.js First commit Jan 27, 2013
package.json Fix typo Mar 30, 2014

README.md

connect-gridfs

GridFS file server for Connect.

Installation

npm install connect-gridfs

Options

  • db — previously opened MongoDB Db instance
  • gzipobject with gzip compression settings or true for default gzip settings, defaulting to false (gzipping disable)

gzip options

Native gzip options:

  • chunkSize
  • windowBits
  • level
  • memLevel
  • strategy
  • dictionary

Additional gzip options:

  • minLength — sets the minimum length of a response that will be gzipped, all responses gzipping by default
  • mimeTypes — enables gzipping of responses for the specified MIME types, all responses gzipping by default

Example

var http = require('http');
var mongodb = require('mongodb');
var connect = require('connect');
var connectGridfs = require('connect-gridfs');

var app = connect();
var server = http.createServer(app);

var db = new mongodb.Db('test', new mongodb.Server('127.0.0.1', 27017, { auto_reconnect: true }), { w: 1 });
db.open(function(err) {
    app.use('/public/', connectGridfs({ db : db, gzip : { level : 4, minLength : 1024 * 16, mimeTypes : ['text/css', 'text/html', 'application/x-javascript'] } }));
    server.listen(3000);
});