writer

package
v0.0.0-...-6e7b241 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Deflate uint16 = 8

Deflate mode compresses archived files

View Source
const Store uint16 = 0

Store mode archives files but does not compress them

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func New

func New(filename string) (*Writer, error)

New eturns an instance of the Writer, the filename is used to create the resulting zip file

func (*Writer) AddFile

func (w *Writer) AddFile(source string, name string) error

AddFile creates a new file entry in the zip archive. source specifies an existing file to read contents from. The name is the path name of the file in the archive. Note that if name is an empty string, the filename from source will be used and the file will be created in the root path.

func (*Writer) AddFolder

func (w *Writer) AddFolder(source string, name string) error

AddFolder creates a new folder entry int the archive and recursively adds all files within the folder. The file structure of the folder is preserved. The name property is used to name the folder path, however, if the name is empty, the folder name will be inferred from the source path and the folder will be stored in the root directory.

func (*Writer) Save

func (w *Writer) Save()

Save closes the underlying zip file and zip writer

func (*Writer) SetMethod

func (w *Writer) SetMethod(method uint16)

SetMethod sets the method to be used for compression. This can Store or Deflate from Writer constants

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL