Skip to content

baryshev/connect-gridfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
});

About

GridFS file server for Connect

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published