npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

brotli-dec-wasm

v2.3.0

Published

Brotli decompressor for browsers and web workers with WASM, which still has a small size (about 200KB)

Downloads

1,710

Readme

brotli-dec-wasm

npm npm unpacked size

Brotli decompressor for browsers and web workers with WASM, which still has a small size (about ~~300KB~~ 200KB)

If you are looking for a compressor, see Alternatives

Features

Usage

Starting from v2.0.0, this package can be used as an exact drop-in replacement of brotli-wasm. You can simply switch between import brotli from 'brotli-wasm' and import brotli from 'brotli-dec-wasm'.

More detailed usage can be found in brotli-wasm Usage section. Examples are also available in the unit tests in brotli-wasm:test/brotli.spec.ts and example projects in brotli-wasm:example. Especially, a TransformStream example is available in brotli-wasm:example/web-next-transformstream/app/utils.ts.

Additionally, we export the JS API generated by wasm-pack and the WASM binary file. They may be useful for cases where you need to instantiate the WASM module with a URL. Check *.asset.* files in example/webpack for examples.

Problems

Broken in webpack 5

BREAKING CHANGE: Since webpack 5 WebAssembly is not enabled by default and flagged as experimental feature. You need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true' (based on async modules) or 'experiments.syncWebAssembly: true' (like webpack 4, deprecated).

Set experiments.syncWebAssembly: true for old code, experiments.asyncWebAssembly: true for new code.

Implementation

The code is quite simple, which is just a wrapper of the crate brotli-decompressor (other than crate brotli, though brotli depends on brotli-decompressor)

Build configuration such as opt-level = "s", are fine-tuned with manual tests, to make the bundle as small as possible

Maintenance

The package is at least used by myself in my blog mylmoe, which provides a page to (de)compress Brotli online

Alternatives

  • brotli-wasm: A reliable compressor and decompressor for Brotli, supporting node & browsers via wasm. If you need a compressor, use it. Actively maintained by an organization.

More alternatives are available in brotli-wasm Alternatives section

One surprising thing is, in js folder of the offical google/brotli repository, there is a pure JavaScript decompressor implementation, which is even a little smaller than this package in size. However, it is not published on NPM. I do not know the reason and since that, I do not suggest using it.

Security

At least >= v1.3.3

  • < v1.3.3: Rust dependency wee_alloc is unmaintained and has open serious issues. Use version >= 1.3.3 to replace it with the default Rust allocator on wasm32 targets.

License

Copyright (C) myl7

SPDX-License-Identifier: MIT OR Apache-2.0