拓恒河湖长制全民护河平台WEB端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

base64.d.ts 3.9KB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /**
  2. * base64.ts
  3. *
  4. * Licensed under the BSD 3-Clause License.
  5. * http://opensource.org/licenses/BSD-3-Clause
  6. *
  7. * References:
  8. * http://en.wikipedia.org/wiki/Base64
  9. *
  10. * @author Dan Kogai (https://github.com/dankogai)
  11. */
  12. declare const version = "3.7.2";
  13. /**
  14. * @deprecated use lowercase `version`.
  15. */
  16. declare const VERSION = "3.7.2";
  17. /**
  18. * polyfill version of `btoa`
  19. */
  20. declare const btoaPolyfill: (bin: string) => string;
  21. /**
  22. * does what `window.btoa` of web browsers do.
  23. * @param {String} bin binary string
  24. * @returns {string} Base64-encoded string
  25. */
  26. declare const _btoa: (bin: string) => string;
  27. /**
  28. * converts a Uint8Array to a Base64 string.
  29. * @param {boolean} [urlsafe] URL-and-filename-safe a la RFC4648 §5
  30. * @returns {string} Base64 string
  31. */
  32. declare const fromUint8Array: (u8a: Uint8Array, urlsafe?: boolean) => string;
  33. /**
  34. * @deprecated should have been internal use only.
  35. * @param {string} src UTF-8 string
  36. * @returns {string} UTF-16 string
  37. */
  38. declare const utob: (u: string) => string;
  39. /**
  40. * converts a UTF-8-encoded string to a Base64 string.
  41. * @param {boolean} [urlsafe] if `true` make the result URL-safe
  42. * @returns {string} Base64 string
  43. */
  44. declare const encode: (src: string, urlsafe?: boolean) => string;
  45. /**
  46. * converts a UTF-8-encoded string to URL-safe Base64 RFC4648 §5.
  47. * @returns {string} Base64 string
  48. */
  49. declare const encodeURI: (src: string) => string;
  50. /**
  51. * @deprecated should have been internal use only.
  52. * @param {string} src UTF-16 string
  53. * @returns {string} UTF-8 string
  54. */
  55. declare const btou: (b: string) => string;
  56. /**
  57. * polyfill version of `atob`
  58. */
  59. declare const atobPolyfill: (asc: string) => string;
  60. /**
  61. * does what `window.atob` of web browsers do.
  62. * @param {String} asc Base64-encoded string
  63. * @returns {string} binary string
  64. */
  65. declare const _atob: (asc: string) => string;
  66. /**
  67. * converts a Base64 string to a Uint8Array.
  68. */
  69. declare const toUint8Array: (a: string) => Uint8Array;
  70. /**
  71. * converts a Base64 string to a UTF-8 string.
  72. * @param {String} src Base64 string. Both normal and URL-safe are supported
  73. * @returns {string} UTF-8 string
  74. */
  75. declare const decode: (src: string) => string;
  76. /**
  77. * check if a value is a valid Base64 string
  78. * @param {String} src a value to check
  79. */
  80. declare const isValid: (src: any) => boolean;
  81. /**
  82. * extend String.prototype with relevant methods
  83. */
  84. declare const extendString: () => void;
  85. /**
  86. * extend Uint8Array.prototype with relevant methods
  87. */
  88. declare const extendUint8Array: () => void;
  89. /**
  90. * extend Builtin prototypes with relevant methods
  91. */
  92. declare const extendBuiltins: () => void;
  93. declare const gBase64: {
  94. version: string;
  95. VERSION: string;
  96. atob: (asc: string) => string;
  97. atobPolyfill: (asc: string) => string;
  98. btoa: (bin: string) => string;
  99. btoaPolyfill: (bin: string) => string;
  100. fromBase64: (src: string) => string;
  101. toBase64: (src: string, urlsafe?: boolean) => string;
  102. encode: (src: string, urlsafe?: boolean) => string;
  103. encodeURI: (src: string) => string;
  104. encodeURL: (src: string) => string;
  105. utob: (u: string) => string;
  106. btou: (b: string) => string;
  107. decode: (src: string) => string;
  108. isValid: (src: any) => boolean;
  109. fromUint8Array: (u8a: Uint8Array, urlsafe?: boolean) => string;
  110. toUint8Array: (a: string) => Uint8Array;
  111. extendString: () => void;
  112. extendUint8Array: () => void;
  113. extendBuiltins: () => void;
  114. };
  115. export { version };
  116. export { VERSION };
  117. export { _atob as atob };
  118. export { atobPolyfill };
  119. export { _btoa as btoa };
  120. export { btoaPolyfill };
  121. export { decode as fromBase64 };
  122. export { encode as toBase64 };
  123. export { utob };
  124. export { encode };
  125. export { encodeURI };
  126. export { encodeURI as encodeURL };
  127. export { btou };
  128. export { decode };
  129. export { isValid };
  130. export { fromUint8Array };
  131. export { toUint8Array };
  132. export { extendString };
  133. export { extendUint8Array };
  134. export { extendBuiltins };
  135. export { gBase64 as Base64 };