Fixed-length types not encoding as expected
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- backend
调研方向
首先使用 r.EncodeStream、r.Struct、r.Buffer 和 r.String 复现示例,然后检查它们的编码路径如何处理固定长度。完成的标准是将两个三字节值都编码为带 null 填充的十字节缓冲区,并与预期输出匹配。
由索引模型根据 Issue 内容生成。
描述
Version: 1.0.0
Issue: I'm using restructure to unpack/pack objects for use in a binary protocol. Given "C-like structures" are a supported feature, I expected the "encode" function to align fields based on the spec provided.
If the spec states a string is 10 bytes long, shouldn't a 3-byte string be null-padded when encoded?
For example:
let stream = new r.EncodeStream();
stream.on('data', console.log);
let encoder = new r.Struct({
foo: new r.Buffer(10),
bar: new r.String(10)
});
encoder.encode(stream, {
foo: Buffer.from('foo'),
bar: 'bar'
});
stream.end();
Expected:
<Buffer 66 6f 6f 00 00 00 00 00 00 00>
<Buffer 62 61 72 00 00 00 00 00 00 00>
Actual:
<Buffer 66 6f 6f>
<Buffer 62 61 72>
- 主要语言
- JavaScript
- 星标
- 146
- 派生
- 37
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
foliojs/restructure 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 45/100
foliojs/restructure#64 ·
-
难度 3/5 1-2 天 新手友好度 25/100
foliojs/restructure#58 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 20/100
foliojs/restructure#55 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
foliojs/restructure#53 · 1 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 20/100
foliojs/restructure#46 ·
查看 foliojs/restructure 的全部 Issue
相似的 Issue
-
area:docs good first issue help wanted priority:medium type:chore
难度 2/5 1-3 小时 新手友好度 76/100
mahmutmft/courses-mcp#51 ·
维护者通常 1 天内回复
-
good first issue roadmap ux
难度 2/5 1-3 小时 新手友好度 88/100
AhmedNavaz/throughline#100 ·
-
good first issue
难度 1/5 1-3 小时 新手友好度 90/100
samiromer2/Ruby-Consent-Portal#26 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
sebastienros/jint#4449 ·
维护者通常 1 天内回复
-
area: site enhancement size: S
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复