GithubHelp home page GithubHelp logo

connect-gridfs's Introduction

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

connect-gridfs's People

Contributors

baryshev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.