33 lines
953 B
JavaScript
33 lines
953 B
JavaScript
/*
|
|
* Template: Read-only script
|
|
* Purpose: inspect data without changing the original buffer.
|
|
* Warning: Replace placeholder host APIs with verified Multi-PROG Help API calls.
|
|
*/
|
|
|
|
const SCRIPT_METADATA = {
|
|
name: "template_readonly",
|
|
version: "0.1.0",
|
|
purpose: "Read-only inspection",
|
|
author: "Repository contributor",
|
|
validation: "Synthetic test data only"
|
|
};
|
|
|
|
function log(message) {
|
|
console.log(`[${SCRIPT_METADATA.name}] ${message}`);
|
|
}
|
|
|
|
function inspectBuffer(buffer) {
|
|
if (!(buffer instanceof Uint8Array)) throw new TypeError("Uint8Array required");
|
|
log(`Buffer length: ${buffer.length}`);
|
|
return { length: buffer.length, preview: Array.from(buffer.slice(0, 16)).map(b => b.toString(16).padStart(2, "0")).join(" ") };
|
|
}
|
|
|
|
function main() {
|
|
const sample = new Uint8Array([0x01, 0x02, 0x03, 0x04]);
|
|
const result = inspectBuffer(sample);
|
|
log(JSON.stringify(result));
|
|
// HOST_SHOW_MESSAGE("Inspection complete")
|
|
}
|
|
|
|
main();
|