Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Feature request: allow `decompress` to decompress stream data without content size in the header

未关闭
#150 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
python

调研方向

使用 zstd.decompress、max_output_size 和 ZstdDecompressor.stream_reader 重现这些示例,以比较当前行为。从 decompress API 入口点及其测试开始;当无需已知的输出大小即可成功解压没有内容大小的帧,并且涵盖所报告的案例时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Edit: this is documented, but I think it would be an useful addition. Maybe by passing max_output_size=-1?

The example below raises ZstdError: could not determine content size in frame header

import io
import zstandard as zstd
data = b'some data'
input_buffer = io.BytesIO(data)
with zstd.ZstdCompressor().stream_reader(input_buffer) as r:
    compressed = r.read()
decompressed = zstd.decompress(compressed)
assert decompressed == data

Passing max_output_size to the decompress call works as expected:

...
decompressed = zstd.decompress(compressed, max_output_size=len(data))
assert decompressed == data

Using ZstdDecompressor.stream_reader also works:

...
with zstd.ZstdDecompressor().stream_reader(io.BytesIO(compressed)) as r:
    decompressed = r.read()
assert decompressed == data

I think decompress should handle this case as well, since it's not always possible to known how the data was compressed.

The package version I use is zstandard 0.15.2 on windows 10 (but I don't think it's os dependent)

主要语言
C
星标
641
派生
117
平均合并
1 天 14 小时
30 天内合并 PR
5

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

indygreg/python-zstandard 的其他 Issue

查看 indygreg/python-zstandard 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。