Google brotli binding to Node.js via Rust and napi-rs
This library is mainly used to test the performance of napi-rs v2. For actual development, please use the
zlib.brotliCompress()method that comes with Node.js.
- Cross-platform support, including Apple M1.
- No need for node-gyp and postinstall, the
.nodefile has been compiled for you.
npm i @brotli/brotli-js
cnpm i @brotli/brotli-js
pnpm i @brotli/brotli-jsnpm run bench
Running "1024 Bytes" suite...
zlib(Native):
262 ops/s, ±6.68% | fastest
iltorb(C++):
248 ops/s, ±3.40% | 5.34% slower
brotli-js(Rust):
115 ops/s, ±1.74% | slowest, 56.11% slowerYou can set the name of the generated .node file in napi.name of package.json.
After npm run build command, you can see brotlijs.[darwin|win32|linux].node file in project root. This is the native addon built from lib.rs.
- Install latest
Rust - Install
Node.js@10+which fully supportedNode-API - Install
[email protected]
- yarn
- yarn build
- yarn test
And you will see:
$ ava --verbose
✔ sync function from native code
✔ sleep function from native code (201ms)
─
2 tests passed
✨ Done in 1.12s.We use GitHub actions to automatically publish npm packages.
# 1.0.0 => 1.0.1
npm version patch
# or 1.0.0 => 1.1.0
npm version minor
git push --follow-tags
MIT