typst-pack 0.5.0

Portable single-file packs of Typst projects: sources, resources, packages, and fonts
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use typst_pack::pack_archive::{
    DecodeError, DecodeLimits, EncodeError, EncodeLimits, decode, encode_with_limits,
};
use typst_pack::{Pack, PackArchiveBytes};

pub fn decode_reference(bytes: impl Into<PackArchiveBytes>) -> Result<Pack, DecodeError> {
    let archive = bytes.into();
    decode(&archive, DecodeLimits::reference_v1())
}

pub fn encode_reference(pack: &Pack) -> Result<PackArchiveBytes, EncodeError> {
    encode_with_limits(pack, EncodeLimits::reference_v1())
}