3.10 Packaged Versions
An OCFL object version MAY be packaged into one or more archive files. If a version is packaged, the entire contents of
that version (including the inventory.json, its sidecar, and the content directory) MUST be stored within the package
files.
A packaged version directory MUST contain a packages.json file and its digest sidecar. It MUST
also contain the package file(s) listed in the packages.json. It MUST NOT contain any other files or directories (such
as loose content or inventory files).
There MUST be only one package format type used per version.
3.10.1 packages.json
The packages.json file acts as a manifest for the package files. It MUST follow the JSON structure described below and
MUST be named packages.json.
-
digestAlgorithm: The digest algorithm used for the package files.
-
type: MUST be https://ocfl.io/2.0/spec/#packaged-versions.
-
manifest: A JSON object where keys are digests of the package files, and values are arrays containing the relative
file paths of those packages within the version directory.
-
format: The packaging format (e.g., zip, tgz).
-
formatVersion: The version of the packaging format.
Example packages.json:
{
"digestAlgorithm": "sha512",
"type": "https://ocfl.io/2.0/spec/#packaged-versions",
"manifest": {
"cde...123": [ "v1/v1.tgz"]
},
"format": "tgz",
"formatVersion": "3.1.1"
}
Example packages.json with multiple packages:
{
"digestAlgorithm": "sha512",
"type": "https://ocfl.io/2.0/spec/#packaged-versions",
"manifest": {
"cde..123": [ "v3/mypackage.v3.z01" ],
"ade..789": [ "v3/mypackage.v3.z02" ],
"ces..229": [ "v3/mypackage.v3.zip" ]
},
"format": "zip",
"formatVersion": "6.3.10"
}
Example OCFL Object directory structure with packaged versions:
Note that version 2 in this example is not packaged, while versions 1 and 3 are.
\[object root\]
├── 0=ocfl\_object\_1.1
├── inventory.json
├── inventory.json.sha512
├── v1
│ ├── packages.json
│ ├── packages.json.sha512
│ └── v1.tgz
├── v2
│ ├── inventory.json
│ ├── inventory.json.sha512
│ └── content
│ └── new-file.txt
└── v3
├── packages.json
├── packages.json.sha512
├── mypackage.v3.z01
├── mypackage.v3.z02
└── mypackage.v3.zip
3.10.2 Package File Names
The package file(s) are enumerated in packages.json stored in the version directory. Therefore, no specific naming
convention is required for packages. It is recommended that the package file names include the version number and the
object id to reduce the potential for file name collisions across the storage root.
3.10.3 Package Structure
All files within a package MUST preserve their full path relative to the OCFL Object Root. For
example, the inventory for version 1 stored inside a package would have the path v1/inventory.json.
3.10.4 Packages Digest
The packages.json file MUST have an accompanying sidecar file named packages.json.ALGORITHM, following the same
rules as the Inventory Digest.
3.10 Packaged Versions
An OCFL object version MAY be packaged into one or more archive files. If a version is packaged, the entire contents of
that version (including the
inventory.json, its sidecar, and the content directory) MUST be stored within the packagefiles.
A packaged version directory MUST contain a
packages.jsonfile and its digest sidecar. It MUSTalso contain the package file(s) listed in the
packages.json. It MUST NOT contain any other files or directories (suchas loose content or inventory files).
There MUST be only one package format type used per version.
3.10.1 packages.json
The
packages.jsonfile acts as a manifest for the package files. It MUST follow the JSON structure described below andMUST be named
packages.json.digestAlgorithm: The digest algorithm used for the package files.type: MUST behttps://ocfl.io/2.0/spec/#packaged-versions.manifest: A JSON object where keys are digests of the package files, and values are arrays containing the relativefile paths of those packages within the version directory.
format: The packaging format (e.g.,zip,tgz).formatVersion: The version of the packaging format.Example
packages.json:{ "digestAlgorithm": "sha512", "type": "https://ocfl.io/2.0/spec/#packaged-versions", "manifest": { "cde...123": [ "v1/v1.tgz"] }, "format": "tgz", "formatVersion": "3.1.1" }Example
packages.jsonwith multiple packages:{ "digestAlgorithm": "sha512", "type": "https://ocfl.io/2.0/spec/#packaged-versions", "manifest": { "cde..123": [ "v3/mypackage.v3.z01" ], "ade..789": [ "v3/mypackage.v3.z02" ], "ces..229": [ "v3/mypackage.v3.zip" ] }, "format": "zip", "formatVersion": "6.3.10" }Example OCFL Object directory structure with packaged versions:
Note that version 2 in this example is not packaged, while versions 1 and 3 are.
3.10.2 Package File Names
The package file(s) are enumerated in packages.json stored in the version directory. Therefore, no specific naming
convention is required for packages. It is recommended that the package file names include the version number and the
object id to reduce the potential for file name collisions across the storage root.
3.10.3 Package Structure
All files within a package MUST preserve their full path relative to the OCFL Object Root. For
example, the inventory for version 1 stored inside a package would have the path
v1/inventory.json.3.10.4 Packages Digest
The
packages.jsonfile MUST have an accompanying sidecar file namedpackages.json.ALGORITHM, following the samerules as the Inventory Digest.