MCPcopy Create free account
hub / github.com/WICG/webpackage / ReadBundleFromFile

Function ReadBundleFromFile

go/bundle/cmd/dump-bundle/main.go:23–40  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

21)
22
23func ReadBundleFromFile(path string) (*bundle.Bundle, error) {
24 fi, err := os.Open(path)
25 if err != nil {
26 return nil, fmt.Errorf("Failed to open input file %q for reading. err: %v", path, err)
27 }
28 defer fi.Close()
29
30 hasIntegrityBlock, err := integrityblock.WebBundleHasIntegrityBlock(fi)
31 if err != nil {
32 return nil, err
33 }
34
35 if hasIntegrityBlock {
36 return nil, errors.New("dump-bundle doesn't support bundles which have been signed using integrity block.")
37 }
38
39 return bundle.Read(fi)
40}
41
42func DumpExchange(e *bundle.Exchange, b *bundle.Bundle, verifier *signature.Verifier) error {
43 payload := e.Response.Body

Callers 1

runFunction · 0.85

Calls 2

ReadFunction · 0.92

Tested by

no test coverage detected