feat(compress): add bounded gzip product codec

This commit is contained in:
Marqdo Agent committed 2026-11-21 10:48:27 +08:00
1 parent ff3f19a2ea
commit efbb8007e1
16 files changed
+372 -9

No files matched your search

+2 -1
View File
@@ -17,6 +17,7 @@ module; a mismatch is a hard error.
- `data/table.mq.md` — value-returning table select/filter/sort/append/set/join/group/GFM
- `env.mq.md` — explicitly granted `env.get` names over `resource.request`
- `process.mq.md` — explicitly granted `process.run` with timeout/output caps
- `compress.mq.md` — deterministic gzip compress/decompress over byte lists
- `random.mq.md` — explicitly granted OS entropy bytes/integers
- `datetime.mq.md` — UTC ISO-8601 format/parse over Unix milliseconds (pure)
- `clock.mq.md` — project-mode `clock.now` over `resource.request`
@@ -24,7 +25,7 @@ module; a mismatch is a hard error.
- `regex.mq.md` — `^ $ . * + ? [...]` matcher and search (no groups)
- `net/http.mq.md` — HTTP/1.1 response parsing (headers/chunked) and request builder
- `tests/` — product self-tests for every public module
(`clock`, `console`, `csv`, `datetime`, `demo`, `env`, `format`, `fs`, `http`,
(`clock`, `compress`, `console`, `csv`, `datetime`, `demo`, `env`, `format`, `fs`, `http`,
`io`, `json`, `path`, `process`, `random`, `regex`, `stream`, `table`, `text`, `utf8`)
The digest is a SHA-256 over sorted `*.mq.md` relative paths, a NUL, file
+17
View File
@@ -0,0 +1,17 @@
## 压缩
`(文本)`
把 UTF-8 文本压缩为 gzip 字节列表(`List<Int>`,0–255)。输入上限
8 MiB;结果确定(不写入时间戳/文件名)。
*resource.request("compress.gzip", [文本])*
## 解压
`(字节列表)`
解压 gzip 字节列表并校验 UTF-8。输出上限 8 MiB;坏 gzip 返回
`compress.invalid`,非 UTF-8 返回 `compress.not_utf8`。
*resource.request("compress.gunzip", [字节列表])*
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "marqdo-stdlib",
"version": "0.1.0",
"digest": "sha256:171c0d31cab5ae70ce6b16fc4c1cf819ab5a8e1895a801d5b2286b642dee5866"
"digest": "sha256:1e5087c05a3c1f5ce0581c834a061d12b88cc0e9eed098b766d4ff1a2ecf859e"
}
+12
View File
@@ -0,0 +1,12 @@
---
import:
compress: "std:compress"
---
## main
**压缩结果 = compress.压缩("hello 世界")**
**解压结果 = compress.解压(压缩结果.value)**
*[压缩结果.ok, 长度(压缩结果.value) > 0, 解压结果.ok, 解压结果.value]*