()
| 96 | } |
| 97 | |
| 98 | function toBase64(input: string): string { |
| 99 | if (typeof globalThis.btoa === 'function') { |
| 100 | return globalThis.btoa(input) |
| 101 | } |
| 102 | |
| 103 | const bufferLike = (globalThis as { Buffer?: BufferLike }).Buffer |
| 104 | |
| 105 | if (bufferLike) { |
| 106 | return bufferLike.from(input, 'utf8').toString('base64') |
| 107 | } |