From 511e1b910f8c332c0078bef3ae67da7ddbf85a01 Mon Sep 17 00:00:00 2001 From: Matthew Schauer Date: Fri, 28 Oct 2022 09:50:28 -0700 Subject: Add Cargo metadata and readme for publishing crate --- Cargo.toml | 8 +++++++- readme.md | 22 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fd8e36c..5f763ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,13 @@ name = "squashfs-ng" version = "0.1.1" authors = ["Matthew Schauer "] -edition = "2018" +edition = "2021" +description = "High-level Rust wrapper for squashfs-tools-ng" +readme = "readme.md" +documentation = "https://docs.rs/squashfs-ng" +repository = "https://github.com/showermat/squashfs-ng-rs" +license = "Apache-2.0" +categories = ["compression", "filesystem"] [build-dependencies] bindgen = "0.53.1" diff --git a/readme.md b/readme.md index c8475cd..74edd86 100644 --- a/readme.md +++ b/readme.md @@ -1 +1,21 @@ -==== UNDER CONSTRUCTION ==== +# squashfs-ng-rs + +This library wraps the [squashfs-tools-ng](https://github.com/AgentD/squashfs-tools-ng) libraries, providing tools for reading and writing SquashFS archives. It aims to provide safe high-level abstractions over the lower-level interface provided by the underlying library. + + // Create an archive from a file hierarchy on disk + use squashfs::write::TreeProcessor; + TreeProcessor::new("archive.sfs")?.process("/path/to/directory")?; + + // Read the contents of a file from an archive + use squashfs::read::Archive; + let archive = Archive::open("archive.sfs")?; + match archive.get("/etc/passwd")? { + None => println!("File not present"), + Some(node) => if let Data::File(file) = node.data()? { + println!("{}", file.to_string()?); + }, + } + +Squashfs-tools-ng must be installed to build or use this library -- for example, [squashfs-tools-ng](https://aur.archlinux.org/packages/squashfs-tools-ng) in the AUR for Arch Linux. + +**See [the API documentation](http://docs.rs/squashfs-ng) for more.** -- cgit v1.2.3