UNPKG

@nberlette/utf8

Version:

Blazing fast universal ponyfills for TextEncoder and TextDecoder.

29 lines 918 B
/** * # `@nick/utf8` * * This package provides blazing-fast, zero-dependency ponyfills for the native * `TextEncoder` and `TextDecoder` APIs, as well as the streaming counterparts, * `TextEncoderStream` and `TextDecoderStream`. * * The ponyfills are based on the WHATWG Encoding standard, and are designed to * work in any ES2015+ environment, including Deno, Node, Bun, and the browser. * * @example * ```ts * import { TextEncoder, TextDecoder } from "@nick/utf8"; * * const encoder = new TextEncoder(); * const decoder = new TextDecoder(); * * const buffer = encoder.encode("Hello, world!"); * const text = decoder.decode(buffer); * * console.log(text); // Outputs: "Hello, world!" * ``` * @module utf8 */ export * from "./text_encoder.js"; export * from "./text_decoder.js"; export * from "./text_encoder_stream.js"; export * from "./text_decoder_stream.js"; //# sourceMappingURL=index.js.map