CoolFace
Apppublic

TrinetraLabs/Placebo_AI

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes
Uint8ArrayReader.js23 linesDownload Raw Back to reader
1"use strict";2var ArrayReader = require("./ArrayReader");3var utils = require("../utils");4 5function Uint8ArrayReader(data) {6    ArrayReader.call(this, data);7}8utils.inherits(Uint8ArrayReader, ArrayReader);9/**10 * @see DataReader.readData11 */12Uint8ArrayReader.prototype.readData = function(size) {13    this.checkOffset(size);14    if(size === 0) {15        // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of [].16        return new Uint8Array(0);17    }18    var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);19    this.index += size;20    return result;21};22module.exports = Uint8ArrayReader;23