szip #

fn extract_zip_to_dir #

fn extract_zip_to_dir(file string, dir string) ?bool

extract zip file to directory

fn open #

fn open(name string, level CompressionLevel, mode OpenMode) ?&Zip

open opens zip archive with compression level using the given mode. name: the name of the zip file to open. level: can be any value of the CompressionLevel enum. mode: can be any value of the OpenMode enum.

fn zip_files #

fn zip_files(path_to_file []string, path_to_export_zip string) ?

zip files (full path) to zip file

fn (Zip) close #

fn (mut z Zip) close()

close closes the zip archive, releases resources - always finalize.

fn (Zip) open_entry #

fn (mut zentry Zip) open_entry(name string) ?

open_entry opens an entry by name in the zip archive. For zip archive opened in 'w' or 'a' mode the function will append a new entry. In readonly mode the function tries to locate the entry in global dictionary.

fn (Zip) close_entry #

fn (mut zentry Zip) close_entry()

close_entry closes a zip entry, flushes buffer and releases resources.

fn (Zip) name #

fn (mut zentry Zip) name() string

name returns a local name of the current zip entry. The main difference between user's entry name and local entry name is optional relative path. Following .ZIP File Format Specification - the path stored MUST not contain a drive or device letter, or a leading slash. All slashes MUST be forward slashes '/' as opposed to backwards slashes '' for compatibility with Amiga and UNIX file systems etc.

fn (Zip) index #

fn (mut zentry Zip) index() ?int

index returns an index of the current zip entry.

fn (Zip) is_dir #

fn (mut zentry Zip) is_dir() ?bool

is_dir determines if the current zip entry is a directory entry.

fn (Zip) size #

fn (mut zentry Zip) size() u64

size returns an uncompressed size of the current zip entry.

fn (Zip) crc32 #

fn (mut zentry Zip) crc32() u32

crc32 returns CRC-32 checksum of the current zip entry.

fn (Zip) write_entry #

fn (mut zentry Zip) write_entry(data []byte) ?

write_entry compresses an input buffer for the current zip entry.

fn (Zip) create_entry #

fn (mut zentry Zip) create_entry(name string) ?

create_entry compresses a file for the current zip entry.

fn (Zip) read_entry #

fn (mut zentry Zip) read_entry() ?voidptr

read_entry extracts the current zip entry into output buffer. The function allocates sufficient memory for an output buffer. NOTE: remember to release the memory allocated for an output buffer. for large entries, please take a look at zip_entry_extract function.

fn (Zip) extract_entry #

fn (mut zentry Zip) extract_entry(path string) ?

extract_entry extracts the current zip entry into output file.

fn (Zip) total #

fn (mut zentry Zip) total() ?int

total returns the number of all entries (files and directories) in the zip archive.

enum CompressionLevel #

enum CompressionLevel {
	no_compression = 0
	best_speed = 1
	best_compression = 9
	uber_compression = 10
	default_level = 6
	default_compression = -1

enum OpenMode #

enum OpenMode {

OpenMode lists the opening modes .write: opens a file for reading/extracting (the file must exists). .read_only: creates an empty file for writing. .append: appends to an existing archive.