const BLOCK_SIZE
pub const BLOCK_SIZE = 512Purpose
Constant BLOCK_SIZE, defining protocol or algorithm parameters.
#archive/tarustar subset: Header + Reader/Writer. Archives are owning strings.
const BLOCK_SIZEpub const BLOCK_SIZE = 512Constant BLOCK_SIZE, defining protocol or algorithm parameters.
const TYPE_REGpub const TYPE_REG = 48Constant TYPE_REG, defining protocol or algorithm parameters.
const TYPE_LINKpub const TYPE_LINK = 49Constant TYPE_LINK, defining protocol or algorithm parameters.
const TYPE_SYMLINKpub const TYPE_SYMLINK = 50Constant TYPE_SYMLINK, defining protocol or algorithm parameters.
const TYPE_DIRpub const TYPE_DIR = 53Constant TYPE_DIR, defining protocol or algorithm parameters.
const TYPE_GNU_LONGLINKpub const TYPE_GNU_LONGLINK = 75Constant TYPE_GNU_LONGLINK, defining protocol or algorithm parameters.
const TYPE_GNU_LONGNAMEpub const TYPE_GNU_LONGNAME = 76Constant TYPE_GNU_LONGNAME, defining protocol or algorithm parameters.
const TYPE_XHEADERpub const TYPE_XHEADER = 120Constant TYPE_XHEADER, defining protocol or algorithm parameters.
const TYPE_XGLOBAL_HEADERpub const TYPE_XGLOBAL_HEADER = 103Constant TYPE_XGLOBAL_HEADER, defining protocol or algorithm parameters.
struct Headerpub struct Header {
pub name string
pub size int
pub mode int
pub typeflag int
pub linkname string
pub uname string
pub gname string
pub mtime int
}Tar Metadata header descriptor structure.
name stringsize intmode inttypeflag intlinkname stringuname stringgname stringmtime intstruct Filepub struct File {
pub name string
pub size int
pub mode int
pub typeflag int
pub linkname string
pub uname string
pub gname string
pub mtime int
pub body string
}Structure encapsulating name, size, mode, typeflag, linkname.
name stringsize intmode inttypeflag intlinkname stringuname stringgname stringmtime intbody stringstruct Readerpub struct Reader {
pub data string
pub pos int
}Tar Streaming reader and decoder.
data stringpos intstruct Writerpub struct Writer {
pub buf string
pub closed int
pub nfiles int
}Tar Streaming writer and encoder.
buf stringclosed intnfiles intnew_headerpub fn new_header() HeaderConstruct header.
No arguments are required.
Header — 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) file_countpub fn (w &Writer) file_count() intOperation on &Writer: file count.
w &WriterWriter instance used by this call (borrow).int — a value of this type
encode_headerpub fn encode_header(h &Header) stringEncode header data. Throws on failure; handle the error or propagate it to the caller.
h &Headerstring — result string
parse_headerpub fn parse_header(blk &string) HeaderParse as header. Throws on failure; handle the error or propagate it to the caller.
blk &stringHeader — a value of this type
($&Reader) nextpub fn (r $&Reader) next() FileOperation on $&Reader: take the next item, or end according to this type. Throws on failure; handle the error or propagate it to the caller.
r $&ReaderReader instance used by this call (exclusive borrow).File — 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) write_headerpub fn (w $&Writer) write_header(h &Header, body &string) intOperation on $&Writer: write header. Throws on failure; handle the error or propagate it to the caller.
w $&WriterWriter instance used by this call (exclusive borrow).h &Headerbody &stringint — a value of this type
($&Writer) write_filepub fn (w $&Writer) write_file(name &string, body &string, mode int) intOperation on $&Writer: write file. Throws on failure; handle the error or propagate it to the caller.
w $&WriterWriter instance used by this call (exclusive borrow).name &stringbody &stringmode intint — a value of this type
($&Writer) write_dirpub fn (w $&Writer) write_dir(name &string, mode int) intOperation on $&Writer: write directory. Throws on failure; handle the error or propagate it to the caller.
w $&WriterWriter instance used by this call (exclusive borrow).name &stringmode intint — a value of this type
($&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) write_entry_headerpub fn (w $&Writer) write_entry_header(h &Header) intwrite_entry_header writes the 512-byte USTAR / GNU header for streaming body writes. Throws on failure; handle the error or propagate it to the caller.
w $&WriterWriter instance used by this call (exclusive borrow).h &Headerint — a value of this type
($&Writer) write_chunkpub fn (w $&Writer) write_chunk(chunk &string) intwrite_chunk streams a chunk of the current file body into the archive. Throws on failure; handle the error or propagate it to the caller.
w $&WriterWriter instance used by this call (exclusive borrow).chunk &stringint — a value of this type
($&Writer) finish_entrypub fn (w $&Writer) finish_entry(file_size int) intfinish_entry pads the current entry to a 512-byte block boundary. Throws on failure; handle the error or propagate it to the caller.
w $&WriterWriter instance used by this call (exclusive borrow).file_size intint — a value of this type