Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ This reduces the bundle size 9x:\
from 90 KiB gzipped for `@exodus/bytes/encoding.js` to 10 KiB gzipped for `@exodus/bytes/encoding-lite.js`.\
(For comparison, `text-encoding` module is 190 KiB gzipped, and `iconv-lite` is 194 KiB gzipped):

| import | size |
| - | - |
| `@exodus/bytes/encoding-browser.js` | ![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-browser.js?style=flat-square) |
| `@exodus/bytes/encoding-lite.js` | ![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-lite.js?style=flat-square) |
| `@exodus/bytes/encoding.js` | ![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding.js?style=flat-square) |
| `text-encoding` | ![](https://img.shields.io/bundlejs/size/text-encoding?style=flat-square) |
| `iconv-lite` | ![](https://img.shields.io/bundlejs/size/iconv-lite?style=flat-square) |
| `whatwg-encoding` | ![](https://img.shields.io/bundlejs/size/whatwg-encoding?style=flat-square) |

_Numbers differ a bit because compression differs._

It still supports `utf-8`, `utf-16le`, `utf-16be` and all single-byte encodings specified by the spec,
the only difference is support for legacy multi-byte encodings.

Expand Down Expand Up @@ -668,6 +679,8 @@ Create a view of a TypedArray in the specified format (`'uint8'` or `'buffer'`)

### @exodus/bytes/encoding.js

![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding.js?style=flat-square)

Implements the [Encoding standard](https://encoding.spec.whatwg.org/):
[TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder),
[TextEncoder](https://encoding.spec.whatwg.org/#interface-textencoder),
Expand Down Expand Up @@ -779,6 +792,8 @@ new TextDecoder(getBOMEncoding(input) ?? fallbackEncoding).decode(input)

### @exodus/bytes/encoding-lite.js

![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-lite.js?style=flat-square)

The exact same exports as `@exodus/bytes/encoding.js` are also exported as
`@exodus/bytes/encoding-lite.js`, with the difference that the lite version does not load
multi-byte `TextDecoder` encodings by default to reduce bundle size 10x.
Expand Down Expand Up @@ -838,6 +853,8 @@ true

### @exodus/bytes/encoding-browser.js

![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-browser.js?style=flat-square)

Same as `@exodus/bytes/encoding.js`, but in browsers instead of polyfilling just uses whatever the
browser provides, drastically reducing the bundle size (to less than 2 KiB gzipped).

Expand Down