Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

index.d.ts 1.1KB

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * Calculates the byte length of a base64 encoded string.
  3. * @param {string} string Base64 encoded string
  4. * @returns {number} Byte length
  5. */
  6. export function length(string: string): number;
  7. /**
  8. * Encodes a buffer to a base64 encoded string.
  9. * @param {Uint8Array} buffer Source buffer
  10. * @param {number} start Source start
  11. * @param {number} end Source end
  12. * @returns {string} Base64 encoded string
  13. */
  14. export function encode(buffer: Uint8Array, start: number, end: number): string;
  15. /**
  16. * Decodes a base64 encoded string to a buffer.
  17. * @param {string} string Source string
  18. * @param {Uint8Array} buffer Destination buffer
  19. * @param {number} offset Destination offset
  20. * @returns {number} Number of bytes written
  21. * @throws {Error} If encoding is invalid
  22. */
  23. export function decode(string: string, buffer: Uint8Array, offset: number): number;
  24. /**
  25. * Tests if the specified string appears to be base64 encoded.
  26. * @param {string} string String to test
  27. * @returns {boolean} `true` if it appears to be base64 encoded, otherwise false
  28. */
  29. export function test(string: string): boolean;