All Projects → pirxpilot → Connect Gzip Static

pirxpilot / Connect Gzip Static

Licence: mit
connect middleware for statically compressed files

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Connect Gzip Static

Django Compression Middleware
Django middleware to compress responses using several algorithms.
Stars: ✭ 23 (-41.03%)
Mutual labels:  middleware, gzip, brotli
Aspnetcore Request Decompression
HTTP request decompression middleware for ASP.NET Core
Stars: ✭ 51 (+30.77%)
Mutual labels:  middleware, gzip, brotli
gzipped
Replacement for golang http.FileServer which supports precompressed static assets.
Stars: ✭ 86 (+120.51%)
Mutual labels:  gzip, brotli
bundle
An online tool to quickly bundle & minify your projects, while viewing the compressed gzip/brotli bundle size, all running locally on your browser.
Stars: ✭ 475 (+1117.95%)
Mutual labels:  gzip, brotli
Express Security
nodejs + express security and performance boilerplate.
Stars: ✭ 37 (-5.13%)
Mutual labels:  gzip, brotli
restio
HTTP Client for Dart inspired by OkHttp
Stars: ✭ 46 (+17.95%)
Mutual labels:  gzip, brotli
lambdafs
Efficient (de)compression package for AWS Lambda
Stars: ✭ 24 (-38.46%)
Mutual labels:  gzip, brotli
pyrus-cramjam
Thin Python wrapper to de/compression algorithms in Rust - lightweight & no dependencies
Stars: ✭ 40 (+2.56%)
Mutual labels:  gzip, brotli
Host Validation
Express.js middleware for "Host" and "Referer" header validation to protect against DNS rebinding attacks.
Stars: ✭ 183 (+369.23%)
Mutual labels:  middleware, express-middleware
stats
📊 Request statistics middleware that stores response times, status code counts, etc
Stars: ✭ 15 (-61.54%)
Mutual labels:  middleware, express-middleware
EasyCompressor
⚡ A compression library that implements many compression algorithms such as LZ4, Zstd, LZMA, Snappy, Brotli, GZip, and Deflate. It helps you to improve performance by reducing Memory Usage and Network Traffic for caching.
Stars: ✭ 167 (+328.21%)
Mutual labels:  gzip, brotli
Archiver
Easily create & extract archives, and compress & decompress files of various formats
Stars: ✭ 3,373 (+8548.72%)
Mutual labels:  gzip, brotli
restish
Restish is a CLI for interacting with REST-ish HTTP APIs with some nice features built-in
Stars: ✭ 453 (+1061.54%)
Mutual labels:  gzip, brotli
Express Basic Auth
Plug & play basic auth middleware for express
Stars: ✭ 241 (+517.95%)
Mutual labels:  middleware, express-middleware
precompress
Generate pre-compressed .gz and .br files for static web servers
Stars: ✭ 27 (-30.77%)
Mutual labels:  gzip, brotli
Compression
Node.js compression middleware
Stars: ✭ 2,506 (+6325.64%)
Mutual labels:  middleware, gzip
restler
Restler is a beautiful and powerful Android app for quickly testing REST API anywhere and anytime.
Stars: ✭ 120 (+207.69%)
Mutual labels:  gzip, brotli
Express Joi Validation
validate express application inputs and parameters using joi
Stars: ✭ 70 (+79.49%)
Mutual labels:  middleware, express-middleware
Gzip
💾 Golang gzip middleware for Gin and net/http | Golang gzip中间件,支持Gin和net/http,开箱即用同时可定制
Stars: ✭ 113 (+189.74%)
Mutual labels:  middleware, gzip
express-firebase-middleware
🔥 Express middleware for your Firebase applications
Stars: ✭ 53 (+35.9%)
Mutual labels:  middleware, express-middleware

NPM version Build Status Dependency Status

connect-gzip-static

Middleware for connect: serves compressed files if they exist, falls through to connect-static if they don't, or if browser does not send 'Accept-Encoding' header.

You should use connect-gzip-static if your build process already creates compressed (using gzip or brotli) files. If you want to compress your data on the fly use compression middleware. And if you want to compress your files dynamically you may want to look up connect gzip.

Installation

  $ npm install connect-gzip-static

Options

gzip-static is meant to be a drop in replacement for connect static middleware. Use the same options as you would with connect static.

Usage

var gzipStatic = require('connect-gzip-static');
var oneDay = 86400000;

connect()
  .use(gzipStatic(__dirname + '/public'))

connect()
  .use(gzipStatic(__dirname + '/public', { maxAge: oneDay }))

How it works

We start by locating all compressed files (ie. files with .gz and .br extensions) in root directory. All HTTP GET and HTTP HEAD requests with Accept-Encoding header set to gzip are checked against the list of compressed files and, if possible, fulfilled by returning the compressed versions. If compressed version is not found or if the request does not have an appropriate Accept- Encoding header, the request is processed in the same way as standard static middleware would handle it.

Debugging

This project uses debug module. To enable the debug log, just set the debug enviromental variable:

DEBUG="connect:gzip-static"

License

MIT © Damian Krzeminski

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].