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

perf(sidecar): raw-binary readFileSync transfer (skip base64)

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
javascript, rust

调研方向

从 crates/execution/src/v8_runtime.rs:183、crates/execution/assets/v8-bridge.source.js 和 crates/v8-runtime/src/host_call.rs 开始,跟踪现有的二进制响应路径。检查其他 {__agentOsType:"bytes"} 消费者,然后为二进制同步读取和 promise 读取添加覆盖,并确保 writeFileBinary 对称;完成标准是二进制读取使用 raw-binary 路径且不经过 base64。

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

描述

Background

Guest binary fs.readFileSync(path) (no encoding) goes
_fs.readFileBinary → _fsReadFileBinary → mapped to fs.readFileSync with the
binary flag (crates/execution/src/v8_runtime.rs:183) → host returns the bytes as
a base64-encoded JSON object (javascript_sync_rpc_bytes_value:
{ "__agentOsType": "bytes", "base64": "..." }), and the guest decodes with
Buffer.from(base64, "base64") (crates/execution/assets/v8-bridge.source.js).

So every binary file read pays base64 encode (host) + decode (guest) plus ~33%
payload inflation. The base64 round-trip is wasted work.

Proposal

Transfer file bytes as raw binary instead of base64. The bridge response
protocol already has a raw-binary path (status = 2 / Uint8Array, see
crates/v8-runtime/src/host_call.rs). Route readFileSync's binary result through
that path and have the guest do Buffer.from(uint8array) directly.

Why it wasn't done in PR #77

The sync-RPC return type is a serde_json::Value, which can't carry raw bytes —
hence the base64 representation. Switching readFileSync to the status=2
raw-binary response is a cross-cutting protocol change that affects every
binary file read, so it was deferred rather than rushed (read was already 6.2×
faster from the pump fix in #77). Needs careful implementation + tests for:
binary readFile (sync + promises), writeFileBinary symmetry, and the
{__agentOsType:"bytes"} consumers elsewhere.

Expected impact

Removes base64 encode/decode + ~33% payload inflation per binary read; helps
read-heavy guests (bundlers, asset pipelines, large node_modules).

主要语言
TypeScript
星标
1k
派生
53
平均合并
2 小时 54 分钟
30 天内合并 PR
5

环境准备

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

从这里开始

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

rivet-dev/dynamic-apps 的其他 Issue

查看 rivet-dev/dynamic-apps 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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