(input)
| 26 | // not use btoa directly as that only works with code points in the range U+0000 to U+00FF, |
| 27 | // inclusive. |
| 28 | function toBase64(input) { |
| 29 | const bytes = new TextEncoder().encode(input); |
| 30 | const byteString = Array.from(bytes, byte => String.fromCharCode(byte)).join(""); |
| 31 | const encoded = self.btoa(byteString); |
| 32 | return encoded; |
| 33 | } |