Package Exports
- @eightnineight/intelhex-codec
- @eightnineight/intelhex-codec/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@eightnineight/intelhex-codec) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
intelhex-codec
decode intel HEX format, and encode data to intel HEX format.
Install
npm install @eightnineight/intelhex-codecUsage
import { intelhexCodec } from "intelhex-codec";
import fs from "fs/promises";
let file = await fs.open("./test.hex");
let inputString = await file.readFile();
const blocks = intelhexCodec.decode.fromString(inputString);
const hexString = intelhexCodec.encode.asString(blocks);
await fs.writeFile("./output.hex", hexString);
// Set the max number of data bytes in each record line to 10 bytes. (default 16 bytes)
const hexString2 = intelhexCodec.encode.asString(blocks, 10);
await fs.writeFile("./output2.hex", hexString2);//Blocks format example
const blocks = [
{ // block 1
address: address1, // block 1 data start address
data: [...], // block 1 data
},
{ // block 2
address: address2, // block 2 data start address
data: [...], // block 2 data
},
//...
];