Skip to content

Module gamster.unpack

gamster.unpack

Functions to unpack bags into object directories.

Unpacking a bag will recreate the original object directory structure from the bag contents and generate the object.csv and datastreams.csv files based on the sip.json metadata in the bag.

unpack_bag

unpack_bag(bag_path, outputdir, overwrite=False)

Unpacks a bag to a object directory in outputdir.

The unpacked object directory will be named according to the object ID in the bag, with ':' replaced by '%3A'.

If overwrite is False and the object directory already exists, a FileExistsError is raised.

Returns the path to the unpacked object directory.

find_bag_folders

find_bag_folders(rootfolder)

Find all bag folders or zipped bag files in or below rootfolder.

Bag directories cannot be nested, but rootfolder can be a bag itself.

Returns a list of Paths to the bag directories or zip files.