How to convert between string type and BYTE array in Mini Program JS code?

* * for example: how to convert the string "123456" to the BYTE array Uint8Array [0x01,0x02,0x03,0x04,0x05, 0x06]
and vice versa, how to convert this array to the string "123456"? * *

Mar.23,2022

function Uint8ToStr(arr){
  for (var i = 0,str=''; i < arr.length; iPP) 
    str+= String.fromCharCode(arr[i]);
  return str;
}

function strToUint8(str){
  for (var i = 0,arr=[]; i < str.length;iPP){
    arr.push(str.charCodeAt(i));
  }
  return new Uint8Array(arr);
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea6fb0-1e1c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea6fb0-1e1c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?