MCPcopy
hub / github.com/bytenode/bytenode / dumpBytecodeHeader

Function dumpBytecodeHeader

lib/index.js:43–61  ·  view source on GitHub ↗
(label, buffer)

Source from the content-addressed store, hash-verified

41// [5] payload length offset 20
42// [6] payload checksum offset 24
43function dumpBytecodeHeader (label, buffer) {
44 const names = [
45 'magic @0 ',
46 'versionHash @4 ',
47 'sourceHash @8 ',
48 'flagHash @12',
49 'roChecksum @16',
50 'payloadLen @20',
51 'checksum @24'
52 ];
53 const lines = [`[bytenode] ${label} (buffer length = ${buffer.length})`];
54 for (let i = 0; i < names.length; i++) {
55 const off = i * 4;
56 if (off + 4 > buffer.length) break;
57 const v = buffer.readUInt32LE(off);
58 lines.push(` ${names[i]} = 0x${v.toString(16).padStart(8, '0')} (${v})`);
59 }
60 console.error(lines.join('\n'));
61}
62
63function generateScript (cachedData, filename) {
64 if (!isBufferV8Bytecode(cachedData)) {

Callers 1

generateScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…