An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 5.7% on proxy.golang.org
Top 3.2% forks on proxy.golang.org

proxy.golang.org : github.com/google/webpackager

Package webpackager implements the control flow of Web Packager. The code below illustrates the usage of this package: Config allows you to change some behaviors of the Packager. packager.Run(url) retrieves an HTTP response using FetchClient, processes it using Processor, and turns it into a signed exchange using ExchangeFactory. Processor inspects the HTTP response to see the eligibility for signed exchanges and manipulates it to optimize the page loading. The generated signed exchanges are stored in ResourceCache to prevent duplicates. The code above sets just two parameters, ExchangeFactory and ResourceCache, and uses the defaults for other parameters. With this setup, the packager retrieves the content just through HTTP, applies the recommended set of optimizations, generates signed exchanges compliant with the version b3, and saves them in files named like "index.html.sxg" under "/tmp/sxg". Config has a few more parameters. See its definition for the details. You can also pass your own implementations to Config to inject custom logic into the packaging flow. You could write, for example, a custom FetchClient to retrieve the content from a database table instead of web servers, a custom Processor or HTMLTask to apply your optimization techniques, a ResourceCache to store the produced signed exchanges into another database table in addition to a local drive, and so on. The cmd/webpackager package provides a command line interface to execute the packaging flow without writing the driver code on your own.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/google/webpackager
License: Apache-2.0
Latest release: over 2 years ago
First release: almost 4 years ago
Namespace: github.com/google
Stars: 68 on GitHub
Forks: 20 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 14 days ago

    Loading...
    Readme
    Loading...