MCPcopy Create free account
hub / github.com/MathMan05/Fermi / get8BitArray

Method get8BitArray

src/webpage/utils/progessiveLoad.ts:25–44  ·  view source on GitHub ↗
(size: number)

Source from the content-addressed store, hash-verified

23 return (await this.get8BitArray(1))[0];
24 }
25 async get8BitArray(size: number) {
26 if (!this.read) throw new Error("not ready to read");
27 this.sizeLeft -= size;
28 const arr = new Uint8Array(size);
29 let arri = 0;
30 while (size > 0) {
31 if (!this.cbuff) throw Error("ran out of file to read");
32 let itter = Math.min(size, this.cbuff.length - this.index);
33 size -= itter;
34 for (let i = 0; i < itter; i++, arri++, this.index++) {
35 arr[arri] = this.cbuff[this.index];
36 }
37
38 if (size !== 0) {
39 this.cbuff = (await this.read.read()).value;
40 this.index = 0;
41 }
42 }
43 return arr;
44 }
45 decoder = new TextDecoder();
46 backChar?: string;
47 chars = "";

Callers 3

IdentifyFileMethod · 0.95
nextMethod · 0.95
getCharMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected