Page: u8 utility functions
v.6 by Sergey Chernov
2019-11-21 11:11
2019-11-21 11:11
Utility functions
utf8Decode(Uint8Array) -> String
Convert typed array (not necessarily byte one) to string using UTF-8 decoder (really fast).
utf8Encode(string) -> Uint8Array
Encodes a string into array of bytes using UTF8 encoding.
Base64 support
exactly as in browsers:
let bas64String = btoa(Uint8Array.of(1,2,3); // AQID
let bytes = atob('AQID'); // [1,2,3] (Uint8Array)
exit([code])
Forces application exit. See u8 main and asyncs.