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

Function writeFooter

go/bundle/encoder.go:542–560  ·  view source on GitHub ↗
(w io.Writer, offset int)

Source from the content-addressed store, hash-verified

540}
541
542func writeFooter(w io.Writer, offset int) error {
543 const footerLength = 9
544
545 bundleSize := uint64(offset) + footerLength
546
547 var b bytes.Buffer
548 if err := binary.Write(&b, binary.BigEndian, bundleSize); err != nil {
549 return err
550 }
551 if b.Len() != 8 {
552 panic("assert")
553 }
554
555 enc := cbor.NewEncoder(w)
556 if err := enc.EncodeByteString(b.Bytes()); err != nil {
557 return err
558 }
559 return nil
560}
561
562func (b *Bundle) WriteTo(w io.Writer) (int64, error) {
563 cw := NewCountingWriter(w)

Callers 1

WriteToMethod · 0.85

Calls 4

EncodeByteStringMethod · 0.95
NewEncoderFunction · 0.92
LenMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected