typora/note/Go/命令行小程序.md
2024-12-12 10:48:55 +08:00

20 lines
257 B
Markdown

### 命令行小程序合计
- gzip 压缩
- gzip 解压
#### gzip 压缩
- go build -o gzip
- gzip < main.go > main.go.gz
```go
package main
import (
"compress/gzip"
"io"
"os"
)
func main() {
w := gzip.NewWriter(os.Stdout)
io.Copy(w, os.Stdin)
}
```