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

Method readWebBundleLength

js/sign/src/core/signed-web-bundle.ts:159–167  ·  view source on GitHub ↗
(bundle: Uint8Array)

Source from the content-addressed store, hash-verified

157
158 // private method, static to emphasize pure functional character
159 private static readWebBundleLength(bundle: Uint8Array): number {
160 // The length of the web bundle is contained in the last 8 bytes of the web
161 // bundle, represented as BigEndian.
162 const buffer = Buffer.from(bundle.slice(-8));
163 // Number is big enough to represent 4GB which is the limit for the web
164 // bundle size which can be contained in a Buffer, which is the format
165 // in which it's passed back to e.g. Webpack.
166 return Number(buffer.readBigUint64BE());
167 }
168}

Callers 1

obtainIntegrityOffsetMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected