GZWriter
Mojo struct 🡭
GZWriter
Section titled “GZWriter”@memory_onlystruct GZWriterWriter for gzip-compressed files.
Fields
Section titled “Fields”- handle (
Optional[Pointer[UInt8, ImmUntrackedOrigin]]) - lib (
ZLib) - filename (
String) - mode (
String)
Implemented traits
Section titled “Implemented traits”AnyType, Deinitable, Movable, WriterBackend
Methods
Section titled “Methods”__init__
Section titled “__init__”fn def __init__(out self, filename: String, mode: String = "wb")Initialize GZWriter with a file path.
Args:
- filename (
String): Path to the output .gz file. - mode (
String): File mode (default “wb” for write binary). - self (
Self)
Returns:
Self
Raises:
Error: If the file cannot be opened for writing.
fn def __init__(out self, *, deinit move: Self)Move constructor.
Args:
- move (
Self) - self (
Self)
Returns:
Self
__deinit__
Section titled “__deinit__”fn def __deinit__(deinit self)Close the file when the object is destroyed.
Args:
- self (
Self)
write_from_buffer
Section titled “write_from_buffer”fn def write_from_buffer(mut self, mut buf: Span[UInt8, MutUntrackedOrigin], amt: Int, pos: Int = Int(0)) -> UInt64Write bytes from buffer to compressed file.
Args:
- self (
Self) - buf (
Span[UInt8, MutUntrackedOrigin]) - amt (
Int) - pos (
Int)
Returns:
UInt64
Raises: