def gz.xlen
import bend-kit-zlib@0.5.1.0/zlib.bend as Zlibimport Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
553# RFC 1952 §2.3: after the fixed 10 bytes, optional FEXTRA, FNAME, FCOMMENT, FHCRC.
554# Each step takes the buffer and the offset so far; None once a field runs past the end.
555def gz.xlen(+off: U32, r: Bytes.Bytes & Maybe<&2, U32>) -> Bytes.Bytes & Maybe<&2, U32>:
556 (b, m) = r
557 match m:
558 case None{}:
559 (b, None{})
560 case Some{+x}:
561 (b, Some{(off + 2 + x : U32)})