base64.d.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import type { BytesLike } from "./data.js";
  2. /**
  3. * Decodes the base-64 encoded %%value%%.
  4. *
  5. * @example:
  6. * // The decoded value is always binary data...
  7. * result = decodeBase64("SGVsbG8gV29ybGQhIQ==")
  8. * //_result:
  9. *
  10. * // ...use toUtf8String to convert it to a string.
  11. * toUtf8String(result)
  12. * //_result:
  13. *
  14. * // Decoding binary data
  15. * decodeBase64("EjQ=")
  16. * //_result:
  17. */
  18. export declare function decodeBase64(value: string): Uint8Array;
  19. /**
  20. * Encodes %%data%% as a base-64 encoded string.
  21. *
  22. * @example:
  23. * // Encoding binary data as a hexstring
  24. * encodeBase64("0x1234")
  25. * //_result:
  26. *
  27. * // Encoding binary data as a Uint8Array
  28. * encodeBase64(new Uint8Array([ 0x12, 0x34 ]))
  29. * //_result:
  30. *
  31. * // The input MUST be data...
  32. * encodeBase64("Hello World!!")
  33. * //_error:
  34. *
  35. * // ...use toUtf8Bytes for this.
  36. * encodeBase64(toUtf8Bytes("Hello World!!"))
  37. * //_result:
  38. */
  39. export declare function encodeBase64(data: BytesLike): string;
  40. //# sourceMappingURL=base64.d.ts.map