Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standalone decompressor for browsers #25

Open
sheffieldnikki opened this issue Feb 28, 2019 · 1 comment
Open

Standalone decompressor for browsers #25

sheffieldnikki opened this issue Feb 28, 2019 · 1 comment

Comments

@sheffieldnikki
Copy link

It would be very helpful to include a pre-built standalone decompressor (and compressor?) for use in browsers #2 , as not everyone is familiar with Node.js.

Here is a unbrotli.js and unbrotli.min.js for use in browsers: unbrotli.zip
unbrotli.min.js is a 92Kb download, or 59Kb if Brotli-compressed by your web server. Much of that is the base64-encoded dictionary.

Called with:

unbrotli(buffer, [outSize])

I built it with the following commands (Ubuntu 16.04):

apt-get install nodejs npm
sed -i "s/dictionary-data/dictionary-browser/" dec/dictionary.js
ln -s /usr/bin/nodejs /usr/bin/node
npm install -g browserify
npm install base64-js
browserify decompress.js --standalone unbrotli -o unbrotli.js

(I couldn't get tinyify or uglify to run without errors, so I used a separate Javascript-minifier.)

@ArthurZhou123
Copy link

I also got an error in use compress.js. And I built this compress.js with your steps.

Uncaught TypeError: Cannot read property 'slice' of null
    at encode.js:11
    at Object.<anonymous> (encode.js:11)
    at Object../node_modules/brotli/build/encode.js (encode.js:56)
    at __webpack_require__ (bootstrap:784)
    at fn (bootstrap:150)
    at Object../node_modules/brotli/compress.js (compress.js:1)
    at __webpack_require__ (bootstrap:784)
    at fn (bootstrap:150)
    at Object../node_modules/brotli/index.js (index.js:1)
    at __webpack_require__ (bootstrap:784)
    at fn (bootstrap:150)
    at Module../src/actions/appActions.js (role-resource-constants.js:91)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants