You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.log(Buffer.from(decompressedData).toString('utf8')); // Prints 'some input'
61
+
console.log(textDecoder.decode(decompressedData)); // Prints 'some input'
54
62
```
55
63
56
-
The package itself has no runtime dependencies, but you will need a [browser Buffer polyfill](https://www.npmjs.com/package/browserify-zlib) for the above example code, or you can do the same using TextEncoder/Decoder instead if you prefer.
64
+
The package itself has no runtime dependencies, although if you prefer using `Buffer` over using `TextEncoder/TextDecoder` you may want a [browser Buffer polyfill](https://www.npmjs.com/package/browserify-zlib).
65
+
66
+
#### In browser with streams:
67
+
68
+
```javascript
69
+
importbrotliPromisefrom'brotli-wasm'; // Import the default export
70
+
71
+
constbrotli=await brotliPromise; // Import is async in browsers due to wasm requirements!
0 commit comments