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

Blocked by browserify - can't find process global.

replete opened this issue · comments

I've worked up a full solution for testing out Brotil: https://github.com/replete/brotli-experiments

However, the script complains about node's process being missing.

Have you had this working in browserify at all?

Unfortunately emscripten and browserify do not play nice together. You need to tell browserify not to parse the emscripten generated files. Use the noParse option, set to node_modules/build/decode.js.

Alternatively, I have a branch called js-decoder that is a pure JS implementation of just the brotli decoder. I haven't merged it yet because it keeps getting out of date with the google/brotli repo, but it should still work, as long as they haven't made spec changes. Feel free to try it out and let me know how it works for you.

I got it to work in the end, the only problem was just a few process calls. My repo above has a bundle.hack.js or similar.

I can't believe asm.js is still unsupported in Safari 9. Ugh, Apple really dropping the ball on stuff like this.

I might checkout your decoder, I think brotli in the browser is quite useful for particular SPA apps.

Have you tried browser-decoding with WOFF2 browsers yet? WOFF2 is Brotli, so in theory we could get the browsers that support it to do the hard work.

I should probably fork your repo and get involved.

Also, just noticed a few things about the issues of using bro as an extension. Is this really the world we live in? Should we out law unix' .man while we're at it? Because clearly that's oppressing women. :|

Pure JS decoder is now merged. require('brotli/decompress') now does not depend on Emscripten.