{"id":33936764,"url":"https://github.com/spire-rs/countio","last_synced_at":"2026-01-21T07:26:32.937Z","repository":{"id":255441280,"uuid":"850832886","full_name":"spire-rs/countio","owner":"spire-rs","description":"💡 Utilities for tracking bytes in sync and async I/O streams, built for applications that need clear throughput metrics and minimal overhead.","archived":false,"fork":false,"pushed_at":"2025-09-17T18:21:16.000Z","size":31,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-14T02:35:43.654Z","etag":null,"topics":["byte","futures","io","parser","tokio"],"latest_commit_sha":null,"homepage":"https://github.com/spire-rs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spire-rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-01T22:40:23.000Z","updated_at":"2025-11-30T15:45:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"936087fc-8c05-4d37-83b5-0b295a841a49","html_url":"https://github.com/spire-rs/countio","commit_stats":null,"previous_names":["spire-rs/countio"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/spire-rs/countio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spire-rs%2Fcountio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spire-rs%2Fcountio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spire-rs%2Fcountio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spire-rs%2Fcountio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spire-rs","download_url":"https://codeload.github.com/spire-rs/countio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spire-rs%2Fcountio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28629915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["byte","futures","io","parser","tokio"],"created_at":"2025-12-12T14:33:23.494Z","updated_at":"2026-01-21T07:26:32.926Z","avatar_url":"https://github.com/spire-rs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## countio\n\n[![Build Status][action-badge]][action-url]\n[![Crate Docs][docs-badge]][docs-url]\n[![Crate Version][crates-badge]][crates-url]\n\n**Check out other `spire` projects [here](https://github.com/spire-rs).**\n\n[action-badge]: https://img.shields.io/github/actions/workflow/status/spire-rs/countio/build.yml?branch=main\u0026label=build\u0026logo=github\u0026style=flat-square\n[action-url]: https://github.com/spire-rs/countio/actions/workflows/build.yml\n[crates-badge]: https://img.shields.io/crates/v/countio.svg?logo=rust\u0026style=flat-square\n[crates-url]: https://crates.io/crates/countio\n[docs-badge]: https://img.shields.io/docsrs/countio?logo=Docs.rs\u0026style=flat-square\n[docs-url]: https://docs.rs/countio\n\nThe wrapper struct to enable byte counting for `std::io::{Read, Write, Seek}`\nand its asynchronous variants from `futures` and `tokio` crates.\n\nSupports bidirectional I/O objects (like `TcpStream` or `Cursor`) that implement\nboth read and write traits, tracking read and write byte counts independently.\n\n### Features\n\n- `std` to enable `std::io::{Read, BufRead, Write, Seek}`. **Enabled by default**.\n- `futures` to enable `futures_io::{AsyncRead, AsyncBufRead, AsyncWrite, AsyncSeek}`.\n- `tokio` to enable `tokio::io::{AsyncRead, AsyncBufRead, AsyncWrite, AsyncSeek}`.\n- `full` to enable all features (`std`, `futures`, and `tokio`).\n\n### Examples\n\n- `std::io::Read`:\n\n```rust\nuse std::io::{BufRead, BufReader, Result};\nuse countio::Counter;\n\nfn main() -\u003e Result\u003c()\u003e {\n    let reader = \"Hello World!\".as_bytes();\n    let reader = BufReader::new(reader);\n    let mut reader = Counter::new(reader);\n\n    let mut buf = String::new();\n    let len = reader.read_line(\u0026mut buf)?;\n\n    assert_eq!(len, reader.reader_bytes());\n    Ok(())\n}\n```\n\n- `std::io::Write`:\n\n```rust\nuse std::io::{BufWriter, Write, Result};\nuse countio::Counter;\n\nfn main() -\u003e Result\u003c()\u003e {\n    let writer = Vec::new();\n    let writer = BufWriter::new(writer);\n    let mut writer = Counter::new(writer);\n\n    let buf = \"Hello World!\".as_bytes();\n    let len = writer.write(buf)?;\n    writer.flush()?;\n\n    assert_eq!(len, writer.writer_bytes());\n    Ok(())\n}\n```\n\n- Bidirectional I/O with `Progress`:\n\n```rust\nuse std::io::{Cursor, Read, Write, Result};\nuse countio::Progress;\n\nfn main() -\u003e Result\u003c()\u003e {\n    let mut data = vec![0u8; 100];\n    let cursor = Cursor::new(\u0026mut data);\n    let mut progress = Progress::with_expected_bytes(cursor, 50, 50);\n\n    // Write some data\n    progress.write_all(b\"Hello\")?;\n    assert_eq!(progress.writer_bytes(), 5);\n    assert_eq!(progress.writer_percentage(), Some(0.1));\n\n    // Seek back and read\n    progress.get_mut().set_position(0);\n    let mut buf = [0u8; 5];\n    progress.read_exact(\u0026mut buf)?;\n    assert_eq!(progress.reader_bytes(), 5);\n    assert_eq!(progress.reader_percentage(), Some(0.1));\n\n    Ok(())\n}\n```\n\n### Other crates\n\n- [SOF3/count-write](https://crates.io/crates/count-write)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspire-rs%2Fcountio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspire-rs%2Fcountio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspire-rs%2Fcountio/lists"}