* Encode the provided string into an array of bytes using the provided * encoding.
(text: string, encoding: string)
| 145 | * encoding. |
| 146 | */ |
| 147 | encode(text: string, encoding: string): Uint8Array { |
| 148 | // See https://www.w3.org/TR/encoding/#utf-16le |
| 149 | if (encoding === "utf-16") { |
| 150 | encoding = "utf16le"; |
| 151 | } |
| 152 | return new Uint8Array(Buffer.from(text, encoding as BufferEncoding)); |
| 153 | } |
| 154 | /** Decode the provided bytes into a string using the provided encoding. */ |
| 155 | decode(bytes: Uint8Array, encoding: string): string { |
| 156 | // See https://www.w3.org/TR/encoding/#utf-16le |
nothing calls this directly
no outgoing calls
no test coverage detected