{"id":16576423,"url":"https://github.com/wcampbell0x2a/librarium","last_synced_at":"2025-10-29T04:32:00.336Z","repository":{"id":137458094,"uuid":"493092900","full_name":"wcampbell0x2a/librarium","owner":"wcampbell0x2a","description":"Library and binaries for the reading, creating, and modification of cpio ","archived":false,"fork":false,"pushed_at":"2025-01-29T12:18:41.000Z","size":120,"stargazers_count":7,"open_issues_count":11,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T22:22:30.819Z","etag":null,"topics":["cpio","extraction","firmware","modification","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wcampbell0x2a.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["wcampbell0x2a"]}},"created_at":"2022-05-17T04:22:50.000Z","updated_at":"2025-01-04T03:20:36.000Z","dependencies_parsed_at":"2023-12-17T01:23:35.566Z","dependency_job_id":"aae8d758-80a1-45c8-b9b1-ab76ba281edd","html_url":"https://github.com/wcampbell0x2a/librarium","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"f29bb7b3cd7db0452bdc8fb96d1191033c99aa5d"},"previous_names":["wcampbell0x2a/librarium"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wcampbell0x2a%2Flibrarium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wcampbell0x2a%2Flibrarium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wcampbell0x2a%2Flibrarium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wcampbell0x2a%2Flibrarium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wcampbell0x2a","download_url":"https://codeload.github.com/wcampbell0x2a/librarium/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238768422,"owners_count":19527197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpio","extraction","firmware","modification","rust"],"created_at":"2024-10-11T22:08:10.553Z","updated_at":"2025-10-29T04:32:00.331Z","avatar_url":"https://github.com/wcampbell0x2a.png","language":"Rust","funding_links":["https://github.com/sponsors/wcampbell0x2a"],"categories":[],"sub_categories":[],"readme":"Librarium\n===========\n\n[\u003cimg alt=\"github\" src=\"https://img.shields.io/badge/github-wcampbell0x2a/librarium-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\" height=\"20\"\u003e](https://github.com/wcampbell0x2a/librarium)\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/librarium.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust\" height=\"20\"\u003e](https://crates.io/crates/librarium)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-librarium-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logo=docs.rs\" height=\"20\"\u003e](https://docs.rs/librarium)\n[\u003cimg alt=\"build status\" src=\"https://img.shields.io/github/actions/workflow/status/wcampbell0x2a/librarium/main.yml?branch=master\u0026style=for-the-badge\" height=\"20\"\u003e](https://github.com/wcampbell0x2a/librarium/actions?query=branch%3Amaster)\n[\u003cimg alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/wcampbell0x2a/librarium?style=for-the-badge\" height=\"20\"\u003e](https://app.codecov.io/gh/wcampbell0x2a/librarium)\n\nLibrary and binaries for the reading, creating, and modification of [cpio](https://en.wikipedia.org/wiki/Cpio) archives.\n\n## Library\n*Compiler support: requires rustc 1.85+*\n\nAdd the following to your `Cargo.toml` file:\n```toml\n[dependencies]\nlibrarium = \"0.4.0\"\n```\n\n### Read\n```rust\nuse std::ffi::CString;\nuse std::io::Cursor;\nuse std::fs::{File, OpenOptions};\nuse librarium::{Header, ArchiveReader, NewcHeader, CpioReader, CpioHeader};\n\nlet mut file = File::open(\"archive.cpio\").unwrap();\nlet mut archive = ArchiveReader::\u003cNewcHeader\u003e::from_reader_with_offset(\u0026mut file, 0).unwrap();\n\n// extract bytes from all in archive\nfor object in \u0026archive.objects.inner {\n    let mut out = OpenOptions::new()\n        .write(true)\n        .create(true)\n        .open(object.header.as_header().name)\n        .unwrap();\n    archive.reader.extract_data(object, \u0026mut out).unwrap();\n}\n```\n\n### Write\n```rust\nuse std::ffi::CString;\nuse std::io::Cursor;\nuse std::fs::File;\nuse librarium::{Header, ArchiveWriter, NewcHeader};\n\nlet file = File::create(\"archive.cpio\").unwrap();\nlet mut writer = ArchiveWriter::\u003cNewcHeader\u003e::new(Box::new(file));\n\n// A\nlet a_data = \"a\\n\".as_bytes();\nlet a_header = Header { name: \"a\".to_string(), ..Header::default()};\nwriter.push_file(Cursor::new(a_data), a_header).unwrap();\n\n// write to archive\nwriter.write().unwrap();\n```\n\n## Binaries\n*Compiler support: requires rustc 1.85+*\n\nThese are currently under development and are missing features, MR's welcome!\n\nTo install, run `cargo install librarium-cli --locked`, or download from the\n[latest github release](https://github.com/wcampbell0x2a/librarium/releases/latest).\n\nSee ``--help`` for more information.\n\n### uncpio-librarium\n```text\ntool to extract and list cpio filesystems\n\nUsage: uncpio-librarium [OPTIONS] \u003cARCHIVE\u003e \u003cFORMAT\u003e\n\nArguments:\n  \u003cARCHIVE\u003e  cpio path\n  \u003cFORMAT\u003e   [possible values: odc, newc]\n\nOptions:\n  -o, --offset \u003cBYTES\u003e   Skip BYTES at the start of FILESYSTEM [default: 0]\n  -d, --dest \u003cPATHNAME\u003e  Extract to [PATHNAME] [default: out]\n  -h, --help             Print help\n  -V, --version          Print version\n```\n\n## Development\nAll patches/merge requests are welcome! See the development guide for more details.\n[DEVELOPMENT.md](DEVELOPMENT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwcampbell0x2a%2Flibrarium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwcampbell0x2a%2Flibrarium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwcampbell0x2a%2Flibrarium/lists"}