/*
 * @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)
{
    var dataString = "";
    for (var i = 0; i < fileData.length; i++)
    {
        dataString += String.fromCharCode(fileData[i]);
    }

    return dataString;
}

function stringToUint8Array(str)
{
    var arr = [];

    for (var i = 0, j = str.length; i < j; ++i)
    {
        arr.push(str.charCodeAt(i));
    }

    var tmpUint8Array = new Uint8Array(arr);

    return tmpUint8Array;
}

export { Uint8ArrayToString, stringToUint8Array };