Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

archive/zip README.md 格式乱 #215

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 48 additions & 36 deletions archive/zip/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
# archive/zip包详解

###常量列表
// 压缩的方法
const (
Store uint16 = 0 // 储存
Deflate uint16 = 8 // 缩小
)
###变量列表:
var (
ErrFormat = errors.New("zip: not a valid zip file") // 不是一个有效的zip文件
ErrAlgorithm = errors.New("zip: unsupported compression algorithm") // 不支持的压缩算法
ErrChecksum = errors.New("zip: checksum error") // 和校验错误
)
###文件结构
type File struct {
FileHeader // 文件数据头
// 包含其它被过滤或未输出的字段
}
###文件数据头结构
type FileHeader struct {
Name string // 写入数据头的文件名称
CreatorVersion uint16 // 创建者版本
ReaderVersion uint16 // 读取者版本
Flags uint16 // 写入标志
Method uint16 // 写入方法
ModifiedTime uint16 // MS-DOS 时间
ModifiedDate uint16 // MS-DOS 日期
CRC32 uint32 // CRC32校验和
CompressedSize uint32 // 压缩后体积
UncompressedSize uint32 // 未压缩体积
Extra []byte // 附加属性
ExternalAttrs uint32 // 外部属性(依赖于创建者版本)
Comment string // 文件注释
}

* [Reader结构 - 读取zip文件](Reader.md)
* [Writer结构 - 创建zip文件](Writer.md)
### 常量列表
```golang
// 压缩的方法
const (
Store uint16 = 0 // 储存
Deflate uint16 = 8 // 缩小
)
```

### 变量列表:
```golang
var (
ErrFormat = errors.New("zip: not a valid zip file") // 不是一个有效的zip文件
ErrAlgorithm = errors.New("zip: unsupported compression algorithm") // 不支持的压缩算法
ErrChecksum = errors.New("zip: checksum error") // 和校验错误
)
```

### 文件结构

```golang
type File struct {
FileHeader // 文件数据头
// 包含其它被过滤或未输出的字段
}
```

### 文件数据头结构

```golang
type FileHeader struct {
Name string // 写入数据头的文件名称
CreatorVersion uint16 // 创建者版本
ReaderVersion uint16 // 读取者版本
Flags uint16 // 写入标志
Method uint16 // 写入方法
ModifiedTime uint16 // MS-DOS 时间
ModifiedDate uint16 // MS-DOS 日期
CRC32 uint32 // CRC32校验和
CompressedSize uint32 // 压缩后体积
UncompressedSize uint32 // 未压缩体积
Extra []byte // 附加属性
ExternalAttrs uint32 // 外部属性(依赖于创建者版本)
Comment string // 文件注释
}
```
* [Reader结构 - 读取zip文件](Reader.md)
* [Writer结构 - 创建zip文件](Writer.md)