const OS_FAT
pub const OS_FAT = 0Purpose
RFC 1952 OS byte. host_os maps xu_target_os: Windows FAT/Win32=0, macOS/Linux Unix=3, other=255. gzip writes 255 by default; Xu records the compile target so archives are platform-honest.
#compress/gzipgzip Reader/Writer with CRC-32.
const OS_FATpub const OS_FAT = 0RFC 1952 OS byte. host_os maps xu_target_os: Windows FAT/Win32=0, macOS/Linux Unix=3, other=255. gzip writes 255 by default; Xu records the compile target so archives are platform-honest.
const OS_UNIXpub const OS_UNIX = 3Constant OS_UNIX, defining protocol or algorithm parameters.
const OS_MACINTOSHpub const OS_MACINTOSH = 7Constant OS_MACINTOSH, defining protocol or algorithm parameters.
const OS_NTFSpub const OS_NTFS = 11Constant OS_NTFS, defining protocol or algorithm parameters.
const OS_UNKNOWNpub const OS_UNKNOWN = 255Constant OS_UNKNOWN, defining protocol or algorithm parameters.
struct Readerpub struct Reader {
pub data string
pub sticky string
}Gzip Streaming reader and decoder.
data stringsticky stringstruct Headerpub struct Header {
pub mtime int
pub name string
pub comment string
pub os int
}Gzip Metadata header descriptor structure.
mtime intname stringcomment stringos intstruct Writerpub struct Writer {
pub buf string
pub out string
pub closed bool
pub name string
pub comment string
pub mtime int
pub os int
}Gzip Streaming writer and encoder.
buf stringout stringclosed boolname stringcomment stringmtime intos inthost_ospub fn host_os() intHost os.
No arguments are required.
int — a value of this type
new_readerpub fn new_reader(data string) ReaderConstruct reader.
data stringReader — a value of this type
new_writerpub fn new_writer() WriterConstruct writer.
No arguments are required.
Writer — a value of this type
($&Writer) set_namepub fn (w $&Writer) set_name(n string)Operation on $&Writer: set name.
w $&WriterWriter instance used by this call (exclusive borrow).n stringThis call does not return a value.
($&Writer) set_commentpub fn (w $&Writer) set_comment(s string)Operation on $&Writer: set comment.
w $&WriterWriter instance used by this call (exclusive borrow).s stringThis call does not return a value.
($&Writer) set_mtimepub fn (w $&Writer) set_mtime(sec int)Operation on $&Writer: set mtime.
w $&WriterWriter instance used by this call (exclusive borrow).sec intThis call does not return a value.
($&Writer) set_ospub fn (w $&Writer) set_os(id int)Operation on $&Writer: set os.
w $&WriterWriter instance used by this call (exclusive borrow).id intThis call does not return a value.
(&Reader) headerpub fn (r &Reader) header() HeaderExecute header on &Reader. Throws on failure; handle the error or propagate it to the caller.
r &ReaderReader instance used by this call (borrow).Header — a value of this type
($&Reader) read_allpub fn (r $&Reader) read_all() stringOperation on $&Reader: read all. Throws on failure; handle the error or propagate it to the caller.
r $&ReaderReader instance used by this call (exclusive borrow).string — result string
($&Writer) writepub fn (w $&Writer) write(data &string) intOperation on $&Writer: write data and return the byte count. Throws on failure; handle the error or propagate it to the caller.
w $&WriterWriter instance used by this call (exclusive borrow).data &stringint — bytes written
($&Writer) write_stringpub fn (w $&Writer) write_string(s string) intOperation on $&Writer: write a string and return the byte count.
w $&WriterWriter instance used by this call (exclusive borrow).s stringint — bytes written
($&Writer) closepub fn (w $&Writer) close() intOperation on $&Writer: close the resource.
w $&WriterWriter instance used by this call (exclusive borrow).int — a value of this type
(&Writer) bytespub fn (w &Writer) bytes() stringOperation on &Writer: return the buffered bytes.
w &WriterWriter instance used by this call (borrow).string — result string
(&Writer) textpub fn (w &Writer) text() stringOperation on &Writer: return the current text.
w &WriterWriter instance used by this call (borrow).string — result string
copy_streampub fn copy_stream#W:StreamWriter,R:StreamReader(dst $&W, src $&R) intEmit a gzip member directly to dst using legal non-final stored deflate blocks, then an empty final block and CRC32/ISIZE trailer. No input or output is accumulated. Returns the uncompressed byte count and closes neither endpoint. Failed copies leave an incomplete member; discard it, don't retry. Throws on failure; handle the error or propagate it to the caller.
dst $&Wsrc $&Rint — a value of this type