Source

arrayBuffer/arrayBufferToString.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayBufferToString = void 0;
/**
 * !! Caution: runtime will be blocked if using this for a large buffer (large file like 1GB)
 *
 * Reference: https://stackoverflow.com/questions/9267899/arraybuffer-to-base64-encoded-string
 * @param buf
 * @category arrayBuffer
 * @module arrayBufferToString
 */
function arrayBufferToString(buf) {
    var binary = '';
    var bytes = new Uint8Array(buf);
    var length = bytes.byteLength;
    for (var i = 0; i < length; i++)
        binary += String.fromCharCode(bytes[i]);
    return binary;
}
exports.arrayBufferToString = arrayBufferToString;
exports.default = arrayBufferToString;