encoding-browser.d.ts 1.1 KB

123456789101112131415161718192021222324
  1. /**
  2. * Same as `@exodus/bytes/encoding.js`, but in browsers instead of polyfilling just uses whatever the
  3. * browser provides, drastically reducing the bundle size (to less than 2 KiB gzipped).
  4. *
  5. * ```js
  6. * import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding-browser.js'
  7. * import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding-browser.js' // Requires Streams
  8. *
  9. * // Hooks for standards
  10. * import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding-browser.js'
  11. * ```
  12. *
  13. * Under non-browser engines (Node.js, React Native, etc.) a full polyfill is used as those platforms
  14. * do not provide sufficiently complete / non-buggy `TextDecoder` APIs.
  15. *
  16. * > [!NOTE]
  17. * > Implementations in browsers [have bugs](https://docs.google.com/spreadsheets/d/1pdEefRG6r9fZy61WHGz0TKSt8cO4ISWqlpBN5KntIvQ/edit),
  18. * > but they are fixing them and the expected update window is short.\
  19. * > If you want to circumvent browser bugs, use full `@exodus/bytes/encoding.js` import.
  20. *
  21. * @module @exodus/bytes/encoding-browser.js
  22. */
  23. export * from './encoding.js'