Skip to content
Branch: master
Find file History
irori gen-bundle: Allow multiple entries for single URL (#541)
This enables `gen-bundle -har` to create bundles that have multiple
entries for single URL, if all responses have Variants: header.
Latest commit 3f0145a Dec 3, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd gen-bundle: Allow multiple entries for single URL (#541) Dec 4, 2019
version Rename "Bundled Exchanges" to "Web Bundles" everywhere. Nov 8, 2019
bundle.go gen-bundle: Verify that an exchange for primary URL exists (#510) Oct 29, 2019
bundle_test.go go/bundle: Rename Has{Variants,Signatures}Support to Supports{Variant… Nov 29, 2019
countingwriter.go Introduce gen-bundle tool to emit "Bundled HTTP Exchanges" [1] Jun 12, 2018
decoder.go go/bundle: Rename Has{Variants,Signatures}Support to Supports{Variant… Nov 29, 2019
encoder.go go/bundle: Rename Has{Variants,Signatures}Support to Supports{Variant… Nov 29, 2019
encoder_test.go gen-bundle: Add support for Variants (#539) Nov 28, 2019
har-devtools.png go/bundle: add Jun 29, 2018


This directory contains a reference implementation of the Web Bundles spec.


We currently provide three command-line tools: gen-bundle, sign-bundle and dump-bundle.

gen-bundle command is a bundle generator tool. gen-bundle consumes a set of http exchanges (currently in the form of HAR format, URL list file, or static files in a local directory), and emits a web bundle.

sign-bundle command attaches a signature to a bundle. sign-bundle takes an existing bundle file, a certificate and a private key, and emits a new bundle file with cryptographic signature for the bundled resources added.

dump-bundle command is a bundle inspector tool. dump-bundle dumps the enclosed http exchanges of a given web bundle file in a human readable form.

You are also welcome to use the code as golang lib (e.g. import ""), but please be aware that the API is not yet stable and is subject to change any time.

Getting Started


golang environment needs to be set up in prior to using the tool. We are testing the tool on latest golang. Please refer to Go Getting Started documentation for the details.


We recommend using go get to install the command-line tool.

go get -u



gen-bundle generates a web bundle. There are three ways to provide a set of exchanges to bundle; by a HAR file, by a URL list, and by a local directory.

These command-line flags are common to all the three options:

  • -primaryURL specifies the bundle's main resource URL. This URL is also used as the fallback destination when browser cannot process the bundle. This option is required.
  • -manifestURL specifies the bundle's manifest URL. This option is optional and can be omitted.
  • -o specifies name of the output bundle file. Default file name if unspecified is out.wbn.
  • -headerOverride adds additional response header to all bundled responses. Existing values of the header are overwritten.

From a HAR file

One convenient way to generate HAR file is via Chrome Devtools. Navigate to "Network" panel, and right-click on any resource and select "Save as HAR with content". generating har with devtools

Once you have the har file, generate the web bundle via:

gen-bundle -har foo.har -o foo.wbn -primaryURL

From a URL list

gen-bundle also accepts -URLList FILE flag. FILE is a plain text file with one URL on each line. gen-bundle fetches these URLs and put the responses into the bundle. For example, you could create urls.txt with:

# A line starting with '#' is a comment.

then run:

gen-bundle -URLList urls.txt \
           -primaryURL \
           -manifestURL \
           -o example_com.wbn

Note that gen-bundle does not automatically discover subresources; you have to enumerate all the necessary subresources in the URL list file.

From a local directory

You can also create a bundle from a local directory. For example, if you have the necessary files for the site in static/ directory, run:

gen-bundle -dir static -baseURL -o foo.wbn -primaryURL


sign-bundle updates a bundle attaching a cryptographic signature of its exchanges. To use this tool, you need a pair of a private key and a certificate in the application/cert-chain+cbor format. See go/signedexchange for more information on how to create a key and certificate pair.

Assuming you have a key and certificate pair for, this command will sign all exchanges in unsigned.wbn whose URL's hostname is, and writes a new bundle to signed.wbn.

sign-bundle \
  -i unsigned.wbn \
  -certificate cert.cbor \
  -privateKey priv.key \
  -validityUrl \
  -o signed.wbn


dump-bundle dumps the content of a web bundle in a human readable form. To display content of a bundle file, invoke:

dump-bundle -i foo.wbn

Using Bundles

Bundles generated with gen-bundle can be opened with web browsers supporting web bundles.

Chrome (79+) experimentally supports Web Bundles with some limitations. See this document for more details.

You can’t perform that action at this time.