GZFile
Mojo struct 🡭
GZFile
Section titled “GZFile”@memory_onlystruct GZFileReader for gzip-compressed files (.gz). Implements the Reader trait like FileReader.
Use for .fastq.gz files with FastqParser. Some builds auto-detect uncompressed
files and pass through; see module docstring. Same interface as FileReader
for drop-in use with parsers.
Example:
from blazeseq import GZFile, FastqParservar r = GZFile("data.fastq.gz", "rb")var parser = FastqParser[GZFile](r^, "illumina_1.8")for record in parser.records(): _ = record.id()Fields
Section titled “Fields”- handle (
c_void_ptr) - lib (
ZLib) - filename (
String) - mode (
String)
Implemented traits
Section titled “Implemented traits”AnyType, ImplicitlyDestructible, Movable, Reader
Methods
Section titled “Methods”__init__
Section titled “__init__”def __init__(out self, filename: String, mode: String)Open a gzip file (e.g. mode “rb” for read binary).
Args:
- filename (
String): Path to the .gz file. - mode (
String): Open mode (e.g. “rb”). - self (
Self)
Returns:
Self
Raises:
Error: If the file cannot be opened.
def __init__(out self, *, deinit take: Self)Args:
- take (
Self) - self (
Self)
Returns:
Self
__del__
Section titled “__del__”def __del__(deinit self)Close the file when the object is destroyed.
Args:
- self (
Self)
read_to_buffer
Section titled “read_to_buffer”def read_to_buffer(mut self, mut buf: Span[Byte, MutExternalOrigin], amt: Int, pos: Int) -> UInt64Read decompressed bytes into buf at offset pos. Returns bytes read (0 at EOF).
Args:
- self (
Self) - buf (
Span) - amt (
Int) - pos (
Int)
Returns:
UInt64
Raises: