cae

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: Apache-2.0 Imports: 4 Imported by: 8

README

Compression and Archive Extensions

GitHub Workflow Status codecov GoDoc Sourcegraph

中文文档

Package cae implements PHP-like Compression and Archive Extensions.

But this package has some modifications depends on Go-style.

Reference: PHP:Compression and Archive Extensions.

Code Convention: based on Go Code Convention.

Implementations

Package zip(Go Walker) and tz(Go Walker) both enable you to transparently read or write ZIP/TAR.GZ compressed archives and the files inside them.

  • Features:
    • Add file or directory from everywhere to archive, no one-to-one limitation.
    • Extract part of entries, not all at once.
    • Stream data directly into io.Writer without any file system storage.
Test cases and Coverage

All subpackages use GoConvey to write test cases, and coverage is more than 80 percent.

Use cases
  • Gogs: self hosted Git service in the Go Programming Language.
  • GoBlog: personal blogging application.
  • GoBuild: online Go cross-platform compilation and download service.

License

This project is under Apache v2 License. See the LICENSE file for the full license text.

Documentation

Overview

Package cae implements PHP-like Compression and Archive Extensions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean added in v1.0.1

func Clean(p string) string

Clean cleans up given path and returns a relative path that goes straight down.

func Copy

func Copy(dest, src string) error

Copy copies file from source to target path.

func HasPrefix

func HasPrefix(name string, prefixes []string) bool

HasPrefix returns true if name has any string in given slice as prefix.

func IsEntry

func IsEntry(name string, entries []string) bool

IsEntry returns true if name equals to any string in given slice.

func IsExist

func IsExist(path string) bool

IsExist returns true if given path is a file or directory.

func IsFilter

func IsFilter(name string) bool

IsFilter returns true if given name matches any of global filter rule.

Types

type HookFunc

type HookFunc func(string, os.FileInfo) error

A HookFunc represents a middleware for packing and extracting archive.

type Streamer

type Streamer interface {
	StreamFile(string, os.FileInfo, []byte) error
	StreamReader(string, os.FileInfo, io.Reader) error
	Close() error
}

A Streamer describes an streamable archive object.

Directories

Path Synopsis
Package tz enables you to transparently read or write TAR.GZ compressed archives and the files inside them.
Package tz enables you to transparently read or write TAR.GZ compressed archives and the files inside them.
Package zip enables you to transparently read or write ZIP compressed archives and the files inside them.
Package zip enables you to transparently read or write ZIP compressed archives and the files inside them.

Jump to

Keyboard shortcuts

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