Replace custom utf-8 convert implementations with `uint8arrays`

This commit is contained in:
Franck Royer 2022-03-25 16:14:42 +11:00
parent 6ef0550433
commit 638b96c17d
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 2 additions and 3 deletions

View File

@ -4,10 +4,9 @@
import { fromString } from "uint8arrays/from-string";
import { toString } from "uint8arrays/to-string";
export const bytesToUtf8 = (bytes: Uint8Array): string =>
toString(bytes, "utf-8");
export const bytesToUtf8 = (b: Uint8Array): string => toString(b, "utf8");
/**
* Encode utf-8 string to byte array
*/
export const utf8ToBytes = (s: string): Uint8Array => fromString(s, "utf-8");
export const utf8ToBytes = (s: string): Uint8Array => fromString(s, "utf8");