bun-file-io
仓库创建 2025年11月8日最近提交 29 天前SkillHot 收录 22 天前
▸ 精选理由
适合需要高效处理大量文件或二进制数据的应用场景。
▸ 风险提示
读写本地文件可能访问或修改敏感数据,请注意权限控制。
这个 Skill 做什么
介绍 Bun 提供的高性能文件读写 API、文件引用与流操作。
讲清楚 Bun 提供的高性能文件读写接口,比如 Bun.file()(惰性文件引用)、Bun.write()、流操作、目录与 glob 模式以及文件元数据。当在 Bun 环境里处理大量文件或要写高性能 I/O 代码时会用到。特别是读写速度和易用性被优化,适合做服务器端文件处理与批量任务。
▸ 展开 SKILL.md 英文原文
Use for Bun file I/O: Bun.file, Bun.write, streams, directories, glob patterns, metadata.
180
Stars
28
Forks
40
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/secondsky/claude-skills/main/plugins/bun/skills/bun-file-io/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/secondsky/claude-skills/main/plugins/bun/skills/bun-file-io/SKILL.md"SKILL.MD 节选查看完整文件 ↗
# Bun File I/O
Bun provides fast, optimized file operations via `Bun.file()` and `Bun.write()`.
## Reading Files
### Bun.file()
```typescript
// Create file reference (lazy, doesn't read yet)
const file = Bun.file("./data.txt");
// File properties
console.log(file.size); // Size in bytes
console.log(file.type); // MIME type
console.log(file.name); // File path
console.log(await file.exists()); // Boolean
// Read content
const text = await file.text();
const json = await file.json();
const buffer = await file.arrayBuffer();
const bytes = await file.bytes(); // Uint8Array
const stream = file.stream(); // ReadableStream
```
### Read Specific Types
```typescrvia SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有