12. Useful Examples

12.1. ZIP archive modification

The following example (refer to the figure below) illustrates how to modify the second file contents of a ZIP archive, and let fuddly recalculate every constraints for you.

1 abszip = dm.get_atom('ZIP')
2 abszip.set_current_conf('ABS', recursive=True)
3 abszip.absorb(zip_buff, constraints=AbsNoCsts(size=True,struct=True)
4
5 abszip['ZIP/file_list/file:2/data'][0].absorb(b'TEST', constraints=AbsNoCsts())
6 abszip.unfreeze(only_generators=True)
7 abszip.get_value()
_images/zip_mod.png

ZIP archive second file contents modification