Module szip stdlib

szip
Version:
0.3.3
License:
MIT
Dependencies from vmod:
0
Imports:
1
Imported by:
0
Repository:
OS-specific
Show selected OS-specific symbols.
Backend-specific
Show selected Backend-specific symbols.

Dependencies defined in v.mod

This section is empty.

Imports

  • Standard Library

Imported by

This section is empty.

Overview

szip is a thin wrapper around miniz.h, which in turn is "Single C source file zlib-replacement library, originally from code.google.com/p/miniz". It provides utility functions for reading/writing .zip files.

TODO Merge/move under vlib/compress/zip .

Aliases

This section is empty.

Constants

This section is empty.

Sum types

This section is empty.

Functions

#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_folder

fn zip_folder(folder string, zip_file string, opt ZipFolderOptions) !

zip_folder zips all entries in folder recursively to the zip file at zip_file.

Empty folders will be included, unless specified otherwise in opt.

Structs

#struct ZipFolderOptions

params
pub struct ZipFolderOptions {
	omit_empty_folders bool
}

Interfaces

This section is empty.

Enums

#enum CompressionLevel

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

CompressionLevel lists compression levels, see in "thirdparty/zip/miniz.h"

#enum OpenMode

pub enum OpenMode {
	write
	read_only
	append
}

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.

#fn (OpenMode) to_u8

inline
fn (om OpenMode) to_u8() u8