Skip to main content

Module pack

Module pack 

Source
Expand description

.eaglepack export and import.

An .eaglepack is a zip archive with no compression (Eagle’s archiver runs with store: true). At its root is pack.json, {"images": [...], "folder": {...}}, followed by each item’s whole <ID>.info/ folder. images holds the item records (their metadata.json contents), newest modificationTime first; folder is present only when a folder was exported and carries its subtree. On import every item and folder gets a new id, so a pack can be imported into the library it came from.

Structs§

PackImport
An import in steps, so a caller can lock the library per item, show progress and stop between items: PackImport::prepare, then PackImport::start, then PackImport::step until it returns None. import_pack runs all of it at once.
PackImportOptions
Settings for import_pack.
PackPlan
A pack worked out but not yet written (see plan_pack). It holds no reference to the library, so it can be written on another thread.
PackPreview
What importing a pack would do, read before asking (Eagle confirms the disk space first, then asks about items it already has).

Enums§

PackSource
What to put in a pack.

Functions§

export_pack
Writes an .eaglepack of source to dest and returns the number of items in it. The archive is checked after writing and removed if it can’t be read back.
extract_pack
Unpacks pack into a temporary folder, the slow, library-free part of an import (an app can do it without holding the library).
import_pack
Imports the pack at pack into lib and returns the new item ids. Items and folders get new ids; a folder pack’s tree is added at the root.
plan_pack
Works out the contents of a pack of source: the pack.json and the item folders to add.
preview_pack
Reads pack.json and the archive’s sizes without extracting anything.
write_pack
Writes a planned pack to dest, calling on_item with the number of item folders added so far, and returns the number of items. The archive is written beside dest, checked and only then moved into place.
write_pack_until
Like write_pack, but on_item returns whether to go on. Returning false stops after that item: nothing is left at dest (the archive is built in a temporary file that is removed) and the result is None.