Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here


A JavaScript port of the Brotli compression algorithm, as used in WOFF2

Subscribe to updates I use brotli.js

Statistics on brotli.js

Number of watchers on Github 196
Number of open issues 6
Average time to close an issue 5 months
Main language JavaScript
Average time to merge a PR 7 days
Open pull requests 1+
Closed pull requests 0+
Last commit over 2 years ago
Repo Created about 5 years ago
Repo Last Updated over 1 year ago
Size 6.75 MB
Organization / Authordevongovett
Page Updated
Do you use brotli.js? Leave a review!
View open issues (6)
View brotli.js activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating brotli.js for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)


Brotli.js is port of the Brotli compression algorithm (as used in the WOFF2 font format) to JavaScript. The decompressor is hand ported, and the compressor is ported with Emscripten. The original C++ source code can be found here.

Installation and usage

Install using npm.

npm install brotli

If you want to use brotli in the browser, you should use Browserify to build it.

In node, or in browserify, you can load brotli in the standard way:

var brotli = require('brotli');

You can also require just the decompress function or just the compress function, which is useful for browserify builds. For example, here's how you'd require just the decompress function.

var decompress = require('brotli/decompress');


brotli.decompress(buffer, [outSize])

Decompresses the given buffer to produce the original input to the compressor. The outSize parameter is optional, and will be computed by the decompressor if not provided. Inside a WOFF2 file, this can be computed from the WOFF2 directory.

// decode a buffer where the output size is known
brotli.decompress(compressedData, uncompressedLength);

// decode a buffer where the output size is not known

brotli.compress(buffer, isText = false)

Compresses the given buffer. Pass optional parameters as the second argument.

// encode a buffer of binary data

// encode some data with options (default options shown)
brotli.compress(fs.readFileSync('myfile.bin'), {
  mode: 0, // 0 = generic, 1 = text, 2 = font (WOFF2)
  quality: 11, // 0 - 11
  lgwin: 22 // window size



brotli.js open issues Ask a question     (View All Issues)
  • about 3 years Aliasify: Syntax Error on "const"
  • almost 4 years Add CLI
brotli.js open pull requests (View All Pulls)
  • Fix decompression of data with multple meta-blocks
brotli.js list of languages used
Other projects in JavaScript