> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xray.cool/llms.txt
> Use this file to discover all available pages before exploring further.

# gzip

> `gzip`函数用于对字符串或字节序列数据进行GZIP压缩。该函数可以接受字符串或字节序列作为输入，并返回一个GZIP压缩后的字符串。

## 函数原型

`func gzip(data string/[]byte) string`

### 参数介绍

| 参数名称 | 参数类型           | 参数介绍              |
| ---- | -------------- | ----------------- |
| data | string/\[]byte | 待压缩的原始字符串数据或字节序列。 |

## 举例

| 输入示例     | 调用语句                | 输出结果                                                       |
| -------- | ------------------- | ---------------------------------------------------------- |
| `"asdf"` | `hex(gzip("asdf"))` | `1f8b08000000000000ff4a2c4e4903040000ffffbdf3295104000000` |
