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
2
3
4
5
6
7
 abszip = dm.get_atom('ZIP')
 abszip.set_current_conf('ABS', recursive=True)
 abszip.absorb(zip_buff, constraints=AbsNoCsts(size=True,struct=True)

 abszip['ZIP/file_list/file:2/data'].absorb(b'TEST', constraints=AbsNoCsts())
 abszip.unfreeze(only_generators=True)
 abszip.get_value()
_images/zip_mod.png

ZIP archive second file contents modification