Giter Club home page Giter Club logo

rack-brotli's Introduction

Rack::Brotli Gem Version Build Status

Brötli, the Swiss German word for a bread roll, on a Rack with some Ruby decorations

Rack::Brotli compresses Rack responses using Google's Brotli compression algorithm.

Brotli generally compresses better than gzip for the same CPU cost and is supported by pretty much everywhere.

Use

Install gem:

gem install rack-brotli

Requiring 'rack/brotli' will autoload the Rack::Brotli module.

The following example shows what a simple rackup (config.ru) file might look like:

require 'rack'
require 'rack/brotli'

use Rack::Brotli # Default compression quality is 5

# You can also provide native Brotli compression options:
# use Rack::Brotli, quality: 11

run theapp

For a Ruby on Rails application, add to your config/application.rb:

config.middleware.use Rack::Deflater
# Rack::Brotli goes directly under Rack::Deflater, if Rack::Deflater is present
config.middleware.use Rack::Brotli

Testing

To run the entire test suite, run

bundle exec rake test

Links

rack-brotli's People

Contributors

cabello avatar danielmorrison avatar marcotc 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  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

rack-brotli's Issues

question: both gzip and brotli?

Hi,

I saw an article that seemed to indicate that both Rack::Deflater and Rack::Brotli could be used simultaneously with one taking precedence? Can you confirm?

Thank you!

Rack::Utils::HeaderHash is deprecated

Hi,

00:28:46 web.1 | /home/dev/.bundle/ruby/3.1/gems/rack-brotli-1.2.0/lib/rack/brotli/deflater.rb:35: warning: Rack::Utils::HeaderHash is deprecated and will be removed in Rack 3.1, switch to Rack::Headers

Cheers!

Add to readme that on standard Rails apps with Rack, to use...

in

application.rb

add "config.middleware.use Rack::Brotli"

directly under "config.middleware.use Rack::Deflater"

to get it to work. Why would the readme not have the most (or at least one of the most) configurations and how to set it up.

This should be in the readme!

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.