{"id":15655352,"url":"https://github.com/nlevitt/warcio-rs","last_synced_at":"2025-09-25T19:07:35.464Z","repository":{"id":65296304,"uuid":"586156855","full_name":"nlevitt/warcio-rs","owner":"nlevitt","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-05T09:00:07.000Z","size":80,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T01:41:29.460Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nlevitt.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-01-07T06:04:39.000Z","updated_at":"2023-03-08T23:14:52.000Z","dependencies_parsed_at":"2024-10-15T21:21:12.430Z","dependency_job_id":null,"html_url":"https://github.com/nlevitt/warcio-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nlevitt/warcio-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlevitt%2Fwarcio-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlevitt%2Fwarcio-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlevitt%2Fwarcio-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlevitt%2Fwarcio-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nlevitt","download_url":"https://codeload.github.com/nlevitt/warcio-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlevitt%2Fwarcio-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276966322,"owners_count":25736758,"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","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-03T12:58:22.029Z","updated_at":"2025-09-25T19:07:35.430Z","avatar_url":"https://github.com/nlevitt.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![tests](https://github.com/nlevitt/warcio-rs/actions/workflows/tests.yml/badge.svg)](https://github.com/nlevitt/warcio-rs/actions)\n\n# warcio-rs\n\n## WARC library for rust\n\nWarcio-rs is a rust library for reading and writing [WARC 1.1][1] files. Input and output are streamed: the WARC record\nbody is a [`Read`][2], both when reading and writing WARCs.\n\n## Sample code\n\nSee [examples][3] for more.\n\n### Read a WARC\n\n```rust\nuse std::fs::File;\nuse std::io::{BufRead, Read};\nuse std::str::from_utf8;\nuse warcio::{LendingIterator as _, WarcReader, WarcRecordHeaderName};\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let f = File::open(\"example.warc.gz\")?;\n    let mut warc_reader = WarcReader::\u003cBox\u003cdyn BufRead\u003e\u003e::try_from(f)?;\n    while let Some(record) = warc_reader.next()? {\n\n        // more convenient api to come\n        let mut content_type: Option\u003c\u0026[u8]\u003e = None;\n        for header in \u0026record.headers {\n            match header.name {\n                WarcRecordHeaderName::ContentType =\u003e content_type = Some(\u0026header.value),\n                _ =\u003e {}\n            }\n        }\n\n        let mut buf: [u8; 20] = [0; 20];\n        let n = record.payload.read(\u0026mut buf)?;\n\n        println!(\n            \"content_type={:?} start of body: {:?}\",\n            from_utf8(content_type.unwrap_or(b\"\u003cn/a\u003e\"))?,\n            \u0026buf[0..n]\n        );\n    }\n\n    Ok(())\n}\n```\n\n### Write a WARC\n\n```rust\nuse chrono::Utc;\nuse std::fs::File;\nuse std::io::BufWriter;\nuse warcio::{WarcRecord, WarcRecordType, WarcRecordWrite as _, WarcWriter};\n\nfn main() -\u003e Result\u003c(), std::io::Error\u003e {\n    let f = File::create(\"example.warc.gz\")?;\n    let mut warc_writer = WarcWriter::new(BufWriter::new(f), true);\n\n    let payload = b\"format: WARC File Format 1.1\\r\\n\";\n    let record: WarcRecord\u003c\u0026[u8]\u003e = WarcRecord::builder()\n        .generate_record_id()\n        .warc_type(WarcRecordType::Warcinfo)\n        .warc_date(Utc::now())\n        .content_type(b\"text/plain\")\n        .content_length(payload.len())\n        .body(\u0026payload[..])\n        .build();\n    warc_writer.write_record(record)?;\n\n    Ok(())\n}\n```\n\n[1]: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/\n[2]: https://doc.rust-lang.org/std/io/trait.Read.html\n[3]: https://github.com/nlevitt/warcio-rs/tree/master/examples\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlevitt%2Fwarcio-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnlevitt%2Fwarcio-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlevitt%2Fwarcio-rs/lists"}