Git Product home page Git Product logo

webbundle's Introduction

Web bundles

build

google/webbundle is a project which aims to provide a high-performace library and various tools for handling Web bundles format.

This is not an officially supported Google product.

Specification

Crates

There are several crates in the repository.

crates.io

The core library. See the documentation.

crates.io

The command line tool for packaging resources as Web Bundles.

Installation

Archives of precompiled binaries for webbundle-cli are available for Windows, macOS and Linux.

If you're using Rust, webbundle-cli can be installed with cargo.

cargo install webbundle-cli

Examples

The binary name for webbundle-cli is webbundle.

create

Create example.wbn from the files under build/dist directory. This is similar to tar cvf example.tar build/dist.

$ webbundle create example.wbn build/dist

list

List the contents of example.wbn. This is similar to tar tvf example.tar.

$ webbundle list ./example.wbn

extract

Extract the contents of example.wbn. This is similar to tar xvf example.tar.

$ webbundle extract ./example.wbn

See webbundle --help for detail usage.

crates.io

The experimental web server which dynamically serves Web bundles from underlying resources.

crates.io

The benchmark tool for measuring the browser's loading performance with Web bundles.

TODO

The development is at very early stage. There are many TODO items:

  • Parser
    • Support b2 format
  • Encoder
    • Support b2 format
  • Web Bundles Builder
    • Create a Web Bundle from a directory structure
    • Low-level APIs to create and manipulate Web Bundle file
  • Use http::Request, http::Response and http::Uri for better ergonomics
  • Use async/await to avoid blocking operations
  • More CLI subcommands
    • create
    • list
    • extract
    • Make these subcommands more ergonomics
  • Focus the performance. Avoid copy as much as possible.
  • Split this crate into several crates:
    • webbundle: Core library
    • webbundle-cli: CLI, like a tar command
    • webbundle-ffi: Foreign function interface for C or C++ program, like a chromium.
    • webbundle-server: Experimental http server which can assemble and serve a webbundle dynamically, based on request parameters
    • webbundle-wasm: WebAssembly binding
    • webbundle-bench: The benchmark tool

Contributing

See contributing.md for instructions.

webbundle's People

Contributors

hayatoito avatar irori avatar jim4067 avatar kination avatar tomokinat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webbundle's Issues

Unable to build a valid .wbn file using the `webbundle` crate

I am trying to build a .wbn using the webbundle crate but cannot make it load on Chrome.


I have tried using the exchanges_from_dir function with the same files as in tests/builder here. This creates the .wbn file and I am able to use dump-bundle from the cli to view the contents, but once I try to load the file into Chrome I get

"Failed to read metadata of Web Bundle file: Invalid bundle length."

in the console.

My code for this case is:

let bundle = Bundle::builder()
  .version(Version::VersionB2)
  .exchanges_from_dir("./test")
  .await?
  .build?;

let write = std::io::BufWriter::new(std::fs::File::create("./local.wbn")?);
data.write_to(write)?;

Using the cli tool, this still doesn't seem to work, but probably I am missing something:

gen-bundle -dir ./test -o local.wbn

I get the following error in Chrome when loading the .wbn:

Failed to read metadata of Web Bundle file: Index section: exchange URL "./" is not valid. (Relative URLs are not allowed in this context.)

I have also tried using a URL with exchanges to build the https://google.com page (just passing this as the primaryURL and an exchange). In this case, the dump-bundle cli command throws:

"bundle.index: failed to decode index section map header: cbor: Expected type 160, got type 96"

and the same error in the chrome console as above. In this case, I am doing a fetch on the https://google.com URL and setting the response in the exchange.

When using the cli tool, this works fine:

# google_urls.txt only contains https://google.com
gen-bundle  -URLList google_urls.txt -primaryURL https://google.com -o google.wbn

Would it be possible to provide working examples for both using a local path and a remote URL?

Simple suggestion on `list`

Hello,
About cli command list, it seems it is showing result like:

...
primary-url: https://proxx.app/
manifest: https://proxx.app//manifest.json
https://proxx.app/ 200 OK 52863 bytes
https://proxx.app/sw.js 200 OK 2780 bytes
https://proxx.app/_headers 200 OK 312 bytes
...

Seems url list are bit unclear to see, so how about making as:

primary-url: https://proxx.app/
manifest: https://proxx.app//manifest.json
[list]
https://proxx.app/ (200 OK) 52,863 bytes
https://proxx.app/sw.js (200 OK) 2,780 bytes
https://proxx.app/_headers (200 OK) 312 bytes

Or maybe we could make bytes as kb if it is to big...

How do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.