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
Copy file name to clipboardExpand all lines: README.md
+23-10Lines changed: 23 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6
# bytecodec
7
7
8
-
Typed JavaScript and TypeScript byte utilities for base58, base58btc, base64, base64url, hex, Z85, UTF-8 strings, unsigned BigInt conversion, JSON, gzip, concatenation, comparison, and byte-source normalization. The package ships tree-shakeable ESM plus CommonJS entry points and keeps the same API across Node, Bun, Deno, browsers, and edge runtimes.
8
+
Typed JavaScript and TypeScript byte utilities for base45, base58, base58btc, base64, base64url, hex, Z85, UTF-8 strings, unsigned BigInt conversion, JSON, gzip, concatenation, comparison, and byte-source normalization. The package ships tree-shakeable ESM plus CommonJS entry points and keeps the same API across Node, Bun, Deno, browsers, and edge runtimes.
Base45 is convenient for QR-friendly payloads. It encodes 2 input bytes into 3 output characters, and a trailing single byte into 2 characters.
74
+
The implementation follows RFC 9285.
75
+
63
76
### Base58
64
77
65
78
```js
@@ -209,7 +222,7 @@ const joined = concat([new Uint8Array([1, 2]), new Uint8Array([3, 4]), [5, 6]])
209
222
210
223
### Node
211
224
212
-
Uses pure JavaScript for base58/base58btc, `Buffer.from` for base64 helpers, `TextEncoder` and `TextDecoder` when available with `Buffer` fallback for UTF-8, and `node:zlib` for gzip.
225
+
Uses pure JavaScript for base45/base58/base58btc, `Buffer.from` for base64 helpers, `TextEncoder` and `TextDecoder` when available with `Buffer` fallback for UTF-8, and `node:zlib` for gzip.
Validation failures throw `BytecodecError` instances with a `code` string, for example `BASE58_INVALID_CHARACTER`, `BASE58BTC_INVALID_PREFIX`, `BASE64URL_INVALID_LENGTH`, `BIGINT_UNSIGNED_EXPECTED`, `HEX_INVALID_CHARACTER`, `Z85_INVALID_BLOCK`, `BASE64_DECODER_UNAVAILABLE`, `UTF8_DECODER_UNAVAILABLE`, and `GZIP_COMPRESSION_UNAVAILABLE`. Messages are prefixed with `{@sovereignbase/bytecodec}`.
237
+
Validation failures throw `BytecodecError` instances with a `code` string, for example `BASE45_INVALID_CHUNK`, `BASE58_INVALID_CHARACTER`, `BASE58BTC_INVALID_PREFIX`, `BASE64URL_INVALID_LENGTH`, `BIGINT_UNSIGNED_EXPECTED`, `HEX_INVALID_CHARACTER`, `Z85_INVALID_BLOCK`, `BASE64_DECODER_UNAVAILABLE`, `UTF8_DECODER_UNAVAILABLE`, and `GZIP_COMPRESSION_UNAVAILABLE`. Messages are prefixed with `{@sovereignbase/bytecodec}`.
225
238
226
239
### Safety / copying semantics
227
240
@@ -231,13 +244,13 @@ Validation failures throw `BytecodecError` instances with a `code` string, for e
231
244
232
245
`npm test` covers:
233
246
234
-
-85 unit tests
235
-
-9 integration tests
236
-
- Node E2E: 27/27 passed in ESM and 27/27 passed in CommonJS
237
-
- Bun E2E: 27/27 passed in ESM and 27/27 passed in CommonJS
238
-
- Deno E2E: 27/27 passed in ESM
239
-
- Cloudflare Workers E2E: 27/27 passed in ESM
240
-
- Edge Runtime E2E: 27/27 passed in ESM
247
+
-97 unit tests
248
+
-10 integration tests
249
+
- Node E2E: 29/29 passed in ESM and 29/29 passed in CommonJS
250
+
- Bun E2E: 29/29 passed in ESM and 29/29 passed in CommonJS
251
+
- Deno E2E: 29/29 passed in ESM
252
+
- Cloudflare Workers E2E: 29/29 passed in ESM
253
+
- Edge Runtime E2E: 29/29 passed in ESM
241
254
- Browser E2E: 5/5 passed in Chromium, Firefox, WebKit, mobile-chrome, and mobile-safari
242
255
- Coverage gate: 100% statements, branches, functions, and lines
0 commit comments