Skip to content

Commit b064e34

Browse files
authored
Add CDN loading example
This is useful for testing out the library - e.g. in a codepen or browser console.
1 parent 4523548 commit b064e34

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ const decompressedData = brotli.decompress(compressedData);
6161
console.log(textDecoder.decode(decompressedData)); // Prints 'some input'
6262
```
6363

64+
You can also load it from a CDN like so:
65+
```javascript
66+
let brotli = await import("https://unpkg.com/[email protected]/index.web.js?module").then(m => m.default);
67+
```
68+
6469
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).
6570

6671
#### In browser with streams:

0 commit comments

Comments
 (0)