|
1 |
| -//! # Read and write to OCI image layout directories |
2 |
| -//! |
3 |
| -//! This library contains medium and low-level APIs for working with |
4 |
| -//! [OCI images], which are basically a directory with blobs and JSON files |
5 |
| -//! for metadata. |
6 |
| -//! |
7 |
| -//! ## Dependency on cap-std |
8 |
| -//! |
9 |
| -//! This library makes use of [cap-std] to operate in a capability-oriented |
10 |
| -//! fashion. In practice, the code in this project is well tested and would |
11 |
| -//! not traverse outside its own path root. However, using capabilities |
12 |
| -//! is a generally good idea when operating in the container ecosystem, |
13 |
| -//! in particular when actively processing tar streams. |
14 |
| -//! |
15 |
| -//! ## Getting started |
16 |
| -//! |
17 |
| -//! To access an existing OCI directory: |
18 |
| -//! |
19 |
| -//! ```rust,no_run |
20 |
| -//! # use ocidir::cap_std; |
21 |
| -//! # use anyhow::{anyhow, Result}; |
22 |
| -//! # fn main() -> anyhow::Result<()> { |
23 |
| -//! let d = cap_std::fs::Dir::open_ambient_dir("/path/to/ocidir", cap_std::ambient_authority())?; |
24 |
| -//! let d = ocidir::OciDir::open(&d)?; |
25 |
| -//! println!("{:?}", d.read_index()?.ok_or_else(|| anyhow!("missing Image Index"))?); |
26 |
| -//! # Ok(()) |
27 |
| -//! # } |
28 |
| -//! ``` |
29 |
| -//! |
30 |
| -//! Users of this crate are likely to want to perform low-level manipulations |
31 |
| -//! such as synthesizing tar layers; [`OciDir::push_layer`] for example can |
32 |
| -//! be used for this. |
33 |
| -//! |
34 |
| -//! [cap-std]: https://docs.rs/cap-std/ |
35 |
| -//! [OCI images]: https://github.com/opencontainers/image-spec |
36 |
| -//! |
| 1 | +#![doc = include_str!("../README.md")] |
37 | 2 |
|
38 | 3 | use cap_std::fs::{Dir, DirBuilderExt};
|
39 | 4 | use cap_std_ext::cap_tempfile;
|
|
0 commit comments