1.0.4 • Published 1 year ago

@eightnineight/intelhex-codec v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

intelhex-codec

decode intel HEX format, and encode data to intel HEX format.

Install

npm install @eightnineight/intelhex-codec

Usage

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
    },
    //...
];
1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago