Crate webbundle

source ·
Expand description

WebBundle library

webbundle is an experimental library for WebBundle format.

Example

WebBundle Parsing

use webbundle::Bundle;
use std::io::{Read as _};

let mut bytes = Vec::new();
std::fs::File::open("example.wbn")?.read_to_end(&mut bytes)?;
let bundle = Bundle::from_bytes(bytes)?;
println!("Parsed bundle: {:#?}", bundle);

Creating a bundle from files

use webbundle::{Bundle, Version};

// Create an empty bundle. See [`Builder`] for details.
let bundle = Bundle::builder()
    .version(Version::VersionB2)
    .build()?;
println!("Created bundle: {:#?}", bundle);
let write = std::io::BufWriter::new(std::fs::File::create("example.wbn")?);
bundle.write_to(write)?;

Structs

A Bundle builder.
Represents a WebBundle.
Represents an HTTP exchange, a pair of a request and a response.
Represents a HTTP exchange’s request.
The URI component of a request.

Enums

Represents the version of WebBundle.

Type Definitions

Result<T, Error>