hexrec.records.save_chunk#
- hexrec.records.save_chunk(path, chunk, address=0, record_type=None, split_args=None, split_kwargs=None, build_args=None, build_kwargs=None)[source]#
Saves a data chunk to a record file.
- Parameters:
path (str) – Path of the output file.
chunk (bytes) – A chunk of data.
address (int) – Address of the data chunk.
record_type (type) – Explicit record type. If
None
, it is guessed from the file extension.split_args (list) – Positional arguments for
Record.split()
.split_kwargs (dict) – Keyword arguments for
Record.split()
.build_args (list) – Positional arguments for
Record.build_standalone()
.build_kwargs (dict) – Keyword arguments for
Record.build_standalone()
.
Example
>>> data = bytes(range(256)) >>> save_chunk('bytes.mot', data, 0x12345678) >>> load_blocks('bytes.mot') == [[0x12345678, data]] True