JavaScript Library - Onix-Systems/GBL-NINJA-SDK-Multiplatform GitHub Wiki
JavaScript Library
Browser and Node.js compatible implementation with interactive web interface for GBL file manipulation.
Installation
Node.js
npm install gbl-ninja
Usage
Parse GBL File
// Parse existing GBL file
const gbl = new Gbl();
const parseResult = gbl.parseByteArray(gblFileBytes);
if (parseResult.type === 'Success') {
console.log(`Parsed ${parseResult.resultList.length} tags`);
// Process tags
} else {
console.error(`Parse error: ${parseResult.error}`);
}
Create GBL File
const builder = Gbl.GblBuilder.create()
.application(32, 0x10000, 0, 54)
.prog(0x1000, firmwareData);
const gblBytes = builder.buildToByteArray();
File Upload (Browser)
const fileInput = document.getElementById('file-input');
fileInput.addEventListener('change', function(event) {
const file = event.target.files[0];
const reader = new FileReader();
reader.onload = function(e) {
const arrayBuffer = e.target.result;
const uint8Array = new Uint8Array(arrayBuffer);
const result = gbl.parseByteArray(uint8Array);
// Process result
};
reader.readAsArrayBuffer(file);
});
Features
- Browser and Node.js compatibility
- Interactive web interface
- File upload/download support
- Real-time parsing feedback
- No external dependencies