Esc

Archive_Writer

structextensionsince 0.36.1Source
  • macOS: Archive_Writer works on macOS
  • Linux: Archive_Writer works on Linux
  • Windows: Archive_Writer works on Windows
  • Wasm: Archive_Writer works on Wasm

Declaration

Archive_Writer :: struct {
    data: *void;    write_proc: Archive_Write_Proc;}

A byte sink for write_archive and copy_entry. It owns nothing and works on every target, wasm included. To write to a file or socket, point data at it and forward to its own write, as forward does for an Extensions/Io writer.

Example
forward :: (data: *void, bytes: [] u8) -> bool {
    _, error := Io.write((cast(*Io.Writer) data).*, bytes);
    return error == .NONE;
}

io_writer := Io.writer_of(*file);
error := write_archive(Archive_Writer.{ data = *io_writer, write_proc = forward }, items, .ZIP);

See also