API
#archive/zip
Xu 0.8.8 API
import: #archive/zip
counts: 3 fns, 7 methods, 3 types, 2 consts, 0 ifaces
zip Reader/Writer (Store and deflate). No ZIP64.
const store
Purpose
ZIP subset aligned with `archive/zip` Reader/Writer common path. Archives are owning strings (no io.Reader). Writer emits Store or deflate (via compress.flate). Reader inflates method 8. No ZIP64, data descriptor, encryption, or disk spanning. Value `0`.
Parameters
none
const deflate
Purpose
Public constant `deflate`. Value `8`.
Parameters
none
struct File
pub struct File {
pub name string
pub method int
pub crc32 int
pub compressed_size int
pub uncompressed_size int
pub body string
}
Purpose
Public struct `File`.
Parameters
name string- name
method int- field (int)
crc32 int- field (int)
compressed_size int- field (int)
uncompressed_size int- field (int)
body string- body
struct Reader
pub struct Reader {
pub data string
pub pos int
}
Purpose
Public struct `Reader`.
Parameters
data string- data
pos int- field (int)
struct Writer
pub struct Writer {
pub buf string
pub names []string
pub methods []int
pub crcs []int
pub comps []int
pub uncomps []int
pub offsets []int
pub closed int
pub comment string
}
Purpose
Public struct `Writer`.
Parameters
buf string- buffer
names []string- field ([]string)
methods []int- field ([]int)
crcs []int- field ([]int)
comps []int- field ([]int)
uncomps []int- field ([]int)
offsets []int- field ([]int)
closed int- field (int)
comment string- field (string)
new_reader
pub fn new_reader(data &string) Reader
Purpose
Construct reader.
Parameters
data &string- data (borrowed; caller keeps it; type &string)
Returns
Reader — a value of this type
new_writer
pub fn new_writer() Writer
Purpose
Construct writer.
Parameters
none
Returns
Writer — a value of this type
(&Writer) file_count
pub fn (w &Writer) file_count() int
Purpose
Method on `&Writer`: file count.
Parameters
w &Writer- receiver &Writer (borrow)
Returns
int — a value of this type
(&Writer) bytes
pub fn (w &Writer) bytes() string
Purpose
Method on `&Writer`: return the buffered bytes.
Parameters
w &Writer- receiver &Writer (borrow)
Returns
string — result string
(&mut Writer) write_file
pub fn (w &mut Writer) write_file(name &string, body &string) int
Purpose
Method on `&mut Writer`: write file.
Parameters
w &mut Writer- receiver &mut Writer (exclusive borrow)
name &string- name (borrowed; caller keeps it; type &string)
body &string- body (borrowed; caller keeps it; type &string)
Returns
int — a value of this type
(&mut Writer) write_file_deflate
pub fn (w &mut Writer) write_file_deflate(name &string, body &string) int
Purpose
Method on `&mut Writer`: write file deflate.
Parameters
w &mut Writer- receiver &mut Writer (exclusive borrow)
name &string- name (borrowed; caller keeps it; type &string)
body &string- body (borrowed; caller keeps it; type &string)
Returns
int — a value of this type
(&mut Writer) close
pub fn (w &mut Writer) close() int
Purpose
Method on `&mut Writer`: close the resource. Throws on failure.
Parameters
w &mut Writer- receiver &mut Writer (exclusive borrow)
Returns
int — a value of this type
(&mut Reader) next
pub fn (r &mut Reader) next() File
Purpose
Method on `&mut Reader`: take the next item, or end according to this type. Throws on failure.
Parameters
r &mut Reader- receiver &mut Reader (exclusive borrow)
Returns
File — a value of this type