foliojs / brotli.js

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Output is bigger than expected

philipahlberg opened this issue · comments

An example of mine: a javascript-file that was 485kb before compression is 299kb after compression with brotli.js. The same file is 94.4kb when compressed 'on-the-fly' with ngx_brotli. I'm using quality 11 compression.

Steps to reproduce would be to install ngx_brotli on an nginx server, and compare file-sizes with the result of the following:

var fs = require('fs')
var brotli = require('brotli')
var result = brotli.compress(someFile, { quality: 11 })
fs.writeFile(someDir, result)

Interesting... have you tried other files? Not just JS, but perhaps JSON, SVG, MarkDown/plain text, etc?

result is byte array and you write in string