---
title: "压缩/解压-gcompress"
url: "https://goframe.org/docs/components/encoding-gcompress"
markdown_url: "https://goframe.org/docs/components/encoding-gcompress.md"
locale: "zh-Hans"
version: "2.10.x(Latest)"
section: "组件列表"
category: "组件列表 / 编码解码"
published: "2024-10-21"
updated: "2026-02-11"
description: "详细介绍`GoFrame`框架`gcompress`模块的二进制数据压缩和解压缩功能，支持`Zlib`和`GZip`两种常用压缩算法。提供简单易用的API接口，帮助开发者快速实现数据压缩解压操作。适用于网络传输、文件存储等需要减少数据体积的场景，提高系统性能和带宽利用率。通过导入`github.com/gogf/gf/v2/encoding/gcompress`包即可使用，具体实现请参考官方API文档。"
keywords: ["GoFrame", "GoFrame框架", "gcompress", "压缩", "解压", "二进制数据", "Zlib", "GZip", "接口文档", "GoFrame编码"]
---

# 压缩/解压-gcompress

二进制数据压缩/解压，支持 `Zlib`/ `GZip` 算法。

**使用方式**：

```go
import "github.com/gogf/gf/v2/encoding/gcompress"
```

**接口文档**：

[https://pkg.go.dev/github.com/gogf/gf/v2/encoding/gcompress](https://pkg.go.dev/github.com/gogf/gf/v2/encoding/gcompress)
