(s: string)
| 1 | export function stringToArrayBuffer(s: string) { |
| 2 | const base64String = unescape(encodeURIComponent(s)); |
| 3 | const charList = base64String.split(""); |
| 4 | const arrayBuffer = []; |
| 5 | for (let i = 0; i < charList.length; i += 1) { |
| 6 | arrayBuffer.push(charList[i].charCodeAt(0)); |
| 7 | } |
| 8 | return new Uint8Array(arrayBuffer); |
| 9 | } |
| 10 | |
| 11 | export function arrayBufferToHex(arrayBuffer: Iterable<number>) { |
| 12 | const byteArray = new Uint8Array(arrayBuffer); |
no outgoing calls
no test coverage detected