foliojs / brotli.js

A JavaScript port of the Brotli compression algorithm, as used in WOFF2
500 stars 51 forks source link

Output is bigger than expected #16

Open philipahlberg opened 7 years ago

philipahlberg commented 7 years ago

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)

tomByrer commented 7 years ago

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

yux0 commented 6 years ago

result is byte array and you write in string