xbstream provides an Reader and Writer implementation of the xbstream archive format.
.
├── cmd/ # 包含可执行命令
│ ├── xbstream/ # xbstream命令行工具
│ ├── xbcrypt/ # xbcrypt加密/解密工具
│ └── try_extract/ # 实验性的提取工具
├── pkg/ # 提供给外部使用的公共库
│ ├── xbstream/ # xbstream归档格式的核心实现
│ ├── xbcrypt/ # 加密/解密功能的核心实现
│ └── index/ # 索引和提取功能实现
├── internal/ # 仅供内部使用的代码
│ └── utils/ # 通用工具函数
└── docs/ # 文档和设计资料
go get github.com/zing22845/go-xbstreamimport "github.com/zing22845/go-xbstream/pkg/xbstream"
// 创建xbstream归档
writer := xbstream.NewWriter(outputFile)
fw, err := writer.Create("filename.txt")
// 写入数据...
// 读取xbstream归档
reader := xbstream.NewReader(inputFile)
for {
chunk, err := reader.Next()
if err == io.EOF {
break
}
// 处理数据块...
}# 创建xbstream归档
xbstream create -i file1 file2 -o archive.xbstream
# 提取xbstream归档
xbstream extract -i archive.xbstream -o /path/to/extractSee LICENSE.txt for details.