Skip to main content

Module archive

Module archive 

Source
Expand description

Archive reading and writing for Codex documents.

Codex documents are packaged as ZIP archives with the .cdx extension. This module provides CdxReader and CdxWriter for working with these archives.

§Reading Documents

use cdx_core::archive::CdxReader;

let mut reader = CdxReader::open("document.cdx")?;
let manifest = reader.manifest();
let content = reader.read_file("content/document.json")?;

§Writing Documents

use cdx_core::archive::CdxWriter;

let mut writer = CdxWriter::create("output.cdx")?;
writer.write_manifest(&manifest)?;
writer.write_file("content/document.json", &content)?;
writer.finish()?;

Structs§

CdxReader
Reader for Codex document archives.
CdxWriter
Writer for creating Codex document archives.
MemoryStorage
In-memory storage for testing purposes.

Enums§

CompressionMethod
Compression method for files in the archive.

Constants§

ACADEMIC_NUMBERING_PATH
Path to the academic numbering configuration file within the archive.
BIBLIOGRAPHY_PATH
Path to the bibliography file within the archive.
COMMENTS_PATH
Path to the collaboration comments file within the archive.
CONTENT_PATH
Path to the content file within the archive.
DUBLIN_CORE_PATH
Path to the Dublin Core metadata file within the archive.
ENCRYPTION_PATH
Path to the encryption metadata file within the archive.
FORMS_DATA_PATH
Path to the form data file within the archive.
JSONLD_PATH
Path to the JSON-LD metadata file within the archive.
MANIFEST_PATH
Path to the manifest file within the archive.
PHANTOMS_PATH
Path to the phantom clusters file within the archive.
SIGNATURES_PATH
Path to the signatures file within the archive.
ZIP_COMMENT
ZIP comment for Codex documents.

Traits§

ArchiveStorage
Trait for archive storage backends.

Functions§

is_url_safe_path
Check whether an asset path contains only URL-safe characters.