Skip to main content
Cross-platform encoding and decoding utilities that work in both browsers and Node.js without relying on the Node.js Buffer class.

Hex

Base64

Bech32

UTF-8

fromUtf8 throws on invalid UTF-8 sequences by default. Pass lossy: true to replace invalid bytes with the Unicode replacement character (U+FFFD).

ASCII

Throws if the input contains characters outside the printable ASCII range (code points below 0x20 or above 0x7E).

RFC 3339 Timestamps

Uint8Array Utilities

Ensures a value is a proper Uint8Array instance with a direct ArrayBuffer backing, which is necessary in some cross-environment scenarios (e.g. when Uint8Array subclass instances from protobuf libraries need normalization).