Git Product home page Git Product logo

chrome-extension-estimate-compression-level's Introduction

chrome-extension-estimate-compression-level

Synopsis

A Chrome browser extension that estimates the compression level of the algorithm used to compress the page.

If you install the extension and then visit https://www.example.com/, you can see that the HTML page was compressed with level 6:

Screenshot

Background

Compression is a core feature of HTTP that improves transfer speed, cache bandwidth utilization and cache utilization.

Lossless data compression algorithms development led to the LZW algorithm (1984), used by the compress application (1985), and then the PKZIP application (1991) with its DEFLATE algorithm which was then used in the gzip format (1992). The zlib library (1995) became a de facto standard compression library for gzip data.

HTTP/1.1 in 1999 (RFC 2616) added support for gzip, compress and deflate compression as content encodings. gzip compression quickly became the default as it compressed better than compress, which used the patented LZW algorithm, and as Microsoft incorrectly implemented deflate as a broken raw deflate stream instead of the correct deflate stream inside a zlib format wrapper.

Compression algorithms generally define a file format and how to decompress it. This allows the user to pick an appropriate compression level: either fast compression, which compresses quickly, but doesn't compress very small or instead best compression, which compresses slowly but generates a smaller output.

With gzip and zlib these levels range from 1 (fast) to 9 (best), with a default of 6.

When you browse to a page with this extension and the content is compressed with gzip, a little badge is shown with the estimated compression level.

If the compression was achieved with a gzip compressor other than zlib, a fractional estimate of zlib compression level is shown.

How does it work?

The chrome extension notes the Content-Length of the page as it is loaded, then fetches the page again, tries to compress it with a variety of levels and then displays the result.

This uses more network and CPU. Use sparingly.

The extension requires webRequest permission to observe and analyze all traffic and webNavigation permission to receive notifications about the status of navigation requests for all traffic.

TODO

Some websites use the newer Brotli compression algorithm instead of gzip. This extension does not support Brotli yet.

Installation

Visit https://chrome.google.com/webstore/detail/lgogndmdpoegjafbbedeedmeofohbopo and click on "Add to Chrome".

Development

Clone this repository.

To use, visit chrome://extensions/ in your Chrome browser. Select "Developer mode" then "Load an unpacked extension" and select the chrome-extension-estimate-compression-level directory. You're all good to go!

Contributing

Send a pull request.

License

The icon was based on "compress icon" from Iconoir, MIT license.

This extension includes pako, MIT license.

This extension is available as open source under the terms of the MIT License.

Future

Is this useful? Let me know! Leon Brocard <[email protected]>

chrome-extension-estimate-compression-level's People

Contributors

acme 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.