MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / readAtom

Function readAtom

modules/base/cli/commands/archive.js:77–84  ·  view source on GitHub ↗
(archive, position)

Source from the content-addressed store, hash-verified

75});
76
77function readAtom(archive, position) {
78 let bytes = new Uint8Array(archive.read(position, 8));
79 let byteLength = (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3];
80 if ((byteLength < 8) || (byteLength > 0x100000))
81 throw new Error("invalid atom size");
82 let name = String.fromCharCode(bytes[4], bytes[5], bytes[6], bytes[7]);
83 return {name, byteLength};
84}
85
86function readString(archive, position) {
87 let result = "";

Callers 1

archive.jsFile · 0.85

Calls 1

readMethod · 0.65

Tested by

no test coverage detected