function strFromU8(dat, latin1) {
    if (latin1) {
        var r = '';
        for (var i = 0; i < dat.length; i += 16384)
            r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));
        return r;
    }
    else if (td) {
        return td.decode(dat);
    }
    else {
        var _a = dutf8(dat), s = _a.s, r = _a.r;
        if (r.length)
            err(8);
        return s;
    }
}
Converts a Uint8Array to a string
@param dat The data to decode to string
@param latin1 Whether or not to interpret the data as Latin-1. This should
              not need to be true unless encoding to binary string.
@returns The original UTF-8/Latin-1 string