Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

brotli-wasm

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brotli-wasm - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

5

index.web.js
// In pure ESM web bundles, you must call init() and wait for the promised result before you can
// call any module methods. To make that as easy as possible, this module directly exposes the
// init() promise result, and returns the methods at the end of the promise.
import init, * as brotliWasm from "./pkg.web/brotli_wasm";
// https://github.com/WICG/import-maps?tab=readme-ov-file#extension-less-imports
// For usage with an importmap, it's convenient to add the ".js" extension here, because browsers
// don't try to guess the file extension.
import init, * as brotliWasm from "./pkg.web/brotli_wasm.js";
export default init().then(() => brotliWasm);

2

package.json
{
"name": "brotli-wasm",
"version": "3.0.0",
"version": "3.0.1",
"description": "A reliable compressor and decompressor for Brotli, supporting node & browsers via wasm",

@@ -5,0 +5,0 @@ "types": "./index.d.ts",

@@ -66,3 +66,3 @@ # brotli-wasm [![Build Status](https://github.com/httptoolkit/brotli-wasm/workflows/CI/badge.svg)](https://github.com/httptoolkit/brotli-wasm/actions) [![Available on NPM](https://img.shields.io/npm/v/brotli-wasm.svg)](https://npmjs.com/package/brotli-wasm)

```javascript
let brotli = await import("https://unpkg.com/brotli-wasm@1.3.1/index.web.js?module").then(m => m.default);
const brotli = await import("https://unpkg.com/brotli-wasm@3.0.0/index.web.js?module").then(m => m.default);
```

@@ -72,2 +72,36 @@

##### Using an importmap
If you've installed `brotli-wasm` as an NPM package, you can load it from your `node_modules` subfolder:
```html
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
<script type="importmap">
{
"imports": {
"brotli-wasm": "/node_modules/brotli-wasm/index.web.js"
}
}
</script>
<script type="module" src="/main.js"></script>
</body>
</html>
```
```javascript
// main.js
import brotliPromise from 'brotli-wasm';
const brotli = await brotliPromise;
const input = 'some input';
const uncompressedData = new TextEncoder().encode(input);
const compressedData = brotli.compress(uncompressedData);
const decompressedData = brotli.decompress(compressedData);
console.log(new TextDecoder().decode(decompressedData)); // Prints 'some input'
```
#### In browser with streams:

@@ -74,0 +108,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc