Attachments handling

Bundles can have local attachments, files that are referenced from the XML. Bundles with attachments are stored as zip files.

The <link>, <repository> and <file> nodes of the bundle XML all have an optional src attribute that can reference attachments. The path of src is relative to the location of the XML document of the bundle.

For the <link> and <repository> nodes, the src attribute can reference individual files or a directory, the <file> node’s src attribute can only reference files.

The Link, Repository and File classes provide several methods to access the attachment, for example open() and copy_to(). When working with an existing zip bundle, the files are accessed directly from the zip file.

When creating a bundle the src attribute of these elements should refer to the file or directory to attach. These files or directories need to remain available on the filesystem until the bundle has been exported using the to_buffer(), to_file() or to_directory() methods, and when using the latter export method, the src paths may not overlap the path to export the bundle to.