https://github.com/go-pay/unzip
支持远程指定文件解压缩的高性能库
https://github.com/go-pay/unzip
go unzip unzip-http
Last synced: 9 months ago
JSON representation
支持远程指定文件解压缩的高性能库
- Host: GitHub
- URL: https://github.com/go-pay/unzip
- Owner: go-pay
- License: apache-2.0
- Created: 2023-11-04T13:30:00.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-03T07:02:30.000Z (about 2 years ago)
- Last Synced: 2025-04-14T23:44:07.490Z (9 months ago)
- Topics: go, unzip, unzip-http
- Language: Go
- Homepage:
- Size: 88.9 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unzip
### 支持远程指定zip文件读取,无需手动解压或下载整个文件
1. 打印本地/远端 ZIP 文件目录
2. 通过文件名本地/远程读取指定文件
3. 通过完整路径+文件名读取本地/远程指定文件
4. 通过完整路径+文件名下载远程指定文件到本地
5. todo:更多功能持续更新中
### Install
```
go get github.com/go-pay/unzip
```
### 使用示例
```golang
package main
import (
"context"
"fmt"
"github.com/go-pay/unzip"
)
func main() {
c := context.Background()
zipUrl := "https://tangboedu-1010.oss-cn-hangzhou.aliyuncs.com/remoteFile.zip"
// 从远端读取指定文件
zr, err := unzip.NewZipReader(c, zipUrl)
if err != nil {
fmt.Println(err)
}
fileStream, err := zr.ReadFileByPath(c, "/remoteFile/level1/level2/level3/version3.txt")
if err != nil {
fmt.Println(err)
}
fileContent := string(fileStream)
fmt.Println(fileContent)
}
```