hexrec.records.save_blocks#

hexrec.records.save_blocks(path, blocks, record_type=None, split_args=None, split_kwargs=None, build_args=None, build_kwargs=None)[source]#

Saves blocks to a record file.

Parameters:
  • path (str) – Path of the output file.

  • blocks (list of blocks) – Sequence of blocks to save.

  • 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

>>> blocks = [[n, bytes(range(n, n + 16))] for n in range(0, 256, 16)]
>>> save_blocks('bytes.hex', blocks)
>>> load_blocks('bytes.hex') == blocks
True