intel_hex 1.2.1 copy "intel_hex: ^1.2.1" to clipboard
intel_hex: ^1.2.1 copied to clipboard

A Dart library that can read and write Intel HEX files. The Intel HEX format is a file format that contains binary information as ASCII text.

example/README.md

Example files #

The full source code for the examples can be found in the examples directory in github.

Intel HEX file linter #

The file "intel_hex_lint.dart" contains all the code you need to validate that an Intel HEX file contains no errors. The program reads a file, and parses all records until the first "End of file" record is found. If there is any type of error (checksum not valid, wrong record block, wrong characters...) an exception is thrown.

The example condensed into a few lines:

import 'package:intel_hex/intel_hex.dart';

try {
  var file = File(path).readAsStringSync();
  var hex = IntelHexFile.fromString(file);
} catch (e) {
  // handle error
}

Binary to Intel HEX file converter #

The file "convert_to_intel_hex.dart" contains all the code you need to convert binary data to an Intel HEX file.

The example condensed into a few lines:

import 'package:intel_hex/intel_hex.dart';

List<int> data = /* fill data */;
var hex = IntelHexFile.fromData(data);
var hexString = hex.toFileContents();

Intel HEX file to binary converter #

The file "convert_to_binary.dart" contains all the code you need to convert an Intel HEX file to binary data.

Try the executables #

You can try the example executables with a few simple commands in the project root directory:

# Runs the linter on an invalid file - will display an error and return a nonzero value
dart ./example/intel_hex_lint.dart ./example/convert_to_intel_hex.dart
# Converts a file to Intel HEX
dart ./example/convert_to_intel_hex.dart ./example/convert_to_intel_hex.dart
# Runs the linter on a valid file
dart ./example/intel_hex_lint.dart ./example/convert_to_intel_hex.dart.hex
# Converts an Intel HEX to binary
dart ./example/convert_to_binary.dart ./example/convert_to_intel_hex.dart.hex
1
likes
160
pub points
67%
popularity

Publisher

unverified uploader

A Dart library that can read and write Intel HEX files. The Intel HEX format is a file format that contains binary information as ASCII text.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on intel_hex