binary-cookies

Crates.iobinary-cookies
lib.rsbinary-cookies
version0.3.1
created_at2025-07-07 13:45:02.226975+00
updated_at2025-08-12 11:47:26.888997+00
descriptionBinaryCookies decode and encode
homepagehttps://github.com/saying121/tidy-browser/tree/master/crates/binary-cookies
repositoryhttps://github.com/saying121/tidy-browser
max_upload_size
id1741293
size119,319
saying (saying121)

documentation

README

BinaryCookies

A BinaryCookies decode and encode crate.

Highlights

  • Sans-io support sync and async.
  • Parallel for large file decoding.

Usage

See: examples

use std::fs::File;

use binary_cookies::sync::{self, DecodeBinaryCookie};
use snafu::{OptionExt, ResultExt, Whatever};

#[snafu::report]
fn main() -> Result<(), Whatever> {
    let mut args = std::env::args();
    args.next();
    let path = args
        .next()
        .whatever_context("Need a path")?;

    let file = File::open(path).with_whatever_context(|_e| "Open file failed")?;

    let a = file
        .decode()
        .with_whatever_context(|_| "Bad file")?;
    let (pages_handle, _meta_decoder) = a.into_handles();
    let a = pages_handle
        .decoders()
        .filter_map(|mut v| v.decode().ok())
        .map(sync::CookieHandle::into_decoders)
        .flat_map(|v| v.filter_map(|mut v| v.decode().ok()))
        .collect::<Vec<_>>();
    dbg!(a);

    Ok(())
}

Reference

BinaryCookies File Format

Commit count: 462

cargo fmt