Documentation
¶
Index ¶
- type CP
- type Chdir
- type DirPushd
- type OSEnv
- func (oe *OSEnv) Append(key string, value string) error
- func (oe *OSEnv) Delete(key string) error
- func (oe *OSEnv) Environ() []string
- func (oe *OSEnv) Get(key string) string
- func (oe *OSEnv) Insert(key string, value string) error
- func (oe *OSEnv) Set(key string, value string) error
- func (oe *OSEnv) WithEnviron(es []string)
- type Tar
- type Wget
- type Zip
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chdir ¶ added in v0.0.3
type Chdir struct {
// contains filtered or unexported fields
}
func (*Chdir) MustGoBack ¶ added in v0.0.3
func (c *Chdir) MustGoBack()
type OSEnv ¶
type OSEnv struct {
// contains filtered or unexported fields
}
func (*OSEnv) WithEnviron ¶
type Tar ¶
type Tar struct {
// UnpackNextBefore 在 Unpack 时,解析到下一个 Header 后,实际 unpack 前的回调
UnpackNextBefore func(h *tar.Header) (skip bool, err error)
// UnpackNextAfter 在 Unpack 时,解析到下一个 Header 后,实际 unpack 后的回调
UnpackNextAfter func(h *tar.Header, err error) error
// UnCompress Unpack 时的解压缩方法,可选
// 默认为按照文件后缀自动选择:
// 1.后缀为 .gz 和 .tgz 时选择 gzip
UnCompress func(rd io.Reader) (io.Reader, error)
// StripComponents Unpack 的时候,忽略掉前 N 层目录
StripComponents uint
// MinSize 最小文件大小,>0 时有效
MinSize int64
// MaxSize 最小文件大小,>0 时有效
MaxSize int64
// IgnoreFailed 是否忽略异常
// 不会忽略 UnpackNextBefore 返回的 error
IgnoreFailed bool
}
Tar tape archive 工具,目前已经具备压缩文件
type Wget ¶
type Wget struct {
LogWriter io.Writer
Proxy func(*http.Request) (*url.URL, error)
// Timeout 整体超时
Timeout time.Duration
// ConnectTimeout 连接超时
ConnectTimeout time.Duration
InsecureSkipVerify bool
}
Wget 提供类似 wget 的功能
type Zip ¶
type Zip struct {
// UnpackNextBefore 在 Unpack 时,解析到下一个 Header 后,实际 unpack 前的回调
UnpackNextBefore func(f *zip.File) (skip bool, err error)
// UnpackNextAfter 在 Unpack 时,解析到下一个 Header 后,实际 unpack 后的回调
UnpackNextAfter func(f *zip.File, err error) error
// StripComponents Unpack 的时候,忽略掉前 N 层目录
StripComponents uint
// MinSize 最小文件大小,>0 时有效
MinSize int64
// MaxSize 最小文件大小,>0 时有效
MaxSize int64
// IgnoreFailed 是否忽略异常
// 不会忽略 UnpackNextBefore 返回的 error
IgnoreFailed bool
}
Zip 解压缩 .zip 文件
Click to show internal directories.
Click to hide internal directories.