Code Monkey home page Code Monkey logo

brotli-js's Introduction

brotli-js

GitHub CI Status

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 .node file has been compiled for you.

Installation

npm i @brotli/brotli-js
cnpm i @brotli/brotli-js
pnpm i @brotli/brotli-js

Support matrix

node12 node14 node16 npm
Windows x64 npm version
Windows x32 npm version
Windows arm64 npm version
macOS x64 npm version
macOS arm64(M1) npm version
Linux x64 gnu npm version
Linux x64 musl npm version
Linux arm gnu npm version
Linux arm64 gnu npm version
Linux arm64 musl npm version
Android arm64 npm version

benchmarks

npm 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% slower

Build

You 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.

Develop requirements

  • Install latest Rust
  • Install Node.js@10+ which fully supported Node-API
  • Install [email protected]

Test in local

  • 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.

Release package

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

License

MIT

brotli-js's People

Contributors

yisibl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.