27 lines
753 B
JavaScript
27 lines
753 B
JavaScript
/*
|
|
* @Author: Kane
|
|
* @Date: 2023-02-13 14:54:46
|
|
* @LastEditors: Kane
|
|
* @LastEditTime: 2023-02-13 14:55:19
|
|
* @FilePath: /pako/src/utils/StringConverter.js
|
|
* @Description:
|
|
*
|
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
|
*/
|
|
function Uint8ArrayToString(fileData) {
|
|
let dataString = "";
|
|
for (let i = 0; i < fileData.length; i++) {
|
|
dataString += String.fromCharCode(fileData[i]);
|
|
}
|
|
return dataString;
|
|
}
|
|
function stringToUint8Array(str) {
|
|
const arr = [];
|
|
for (let i = 0, j = str.length; i < j; ++i) {
|
|
arr.push(str.charCodeAt(i));
|
|
}
|
|
const tmpUint8Array = new Uint8Array(arr);
|
|
return tmpUint8Array;
|
|
}
|
|
export { Uint8ArrayToString, stringToUint8Array };
|
|
//# sourceMappingURL=StringConvert.js.map
|