bun-file

bun-file is a cursor rule for Cursor from takuya0206/bigquery-mcp-server. It costs 0 tokens per session (2,169 once invoked), scanned C, original, MIT.

A Bun documentation rule for reading and writing files with Bun.file and Bun.write. Bun is a JavaScript runtime, and these APIs provide file references and ways to read file contents as text, streams, bytes, or buffers.

In plain words
What is it for?
Create file references, inspect file size and type, read files in several formats, write files, and use Node’s file-system functions for operations such as creating directories or listing files.
Why use it?
It points developers toward the documented Bun file APIs and clarifies that some directory operations still use Node’s file-system module.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/takuya0206/bigquery-mcp-server/bun-file
Clone the repo
git clone --depth 1 https://github.com/takuya0206/bigquery-mcp-server

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bun-file

README.md
[![agentmods](https://agentmods.dev/badge/rules/takuya0206/bigquery-mcp-server/bun-file.svg)](https://agentmods.dev/rules/takuya0206/bigquery-mcp-server/bun-file)
Your own site
<a href="https://agentmods.dev/rules/takuya0206/bigquery-mcp-server/bun-file"><img src="https://agentmods.dev/badge/rules/takuya0206/bigquery-mcp-server/bun-file.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,169 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02169
Opus 5 $0.00000 $0.01085
Sonnet 5 $0.00000 $0.00434
Haiku 4.5 $0.00000 $0.00217

Measured 4d ago against content hash 46bab1907fd6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

bun-file scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- **Note** — The `Bun.file` and `Bun.write` APIs documented on this page are heavily optimized and represent the recommended way to perform file-system tasks using Bun. Existing Node.js projects may use Bun's [nearly
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

  • bun-file — 100% identical, 0 lines differ
.cursor/rules/bun-file.mdc · 369 lines

How it starts

The opening of the file, as written. The whole thing — 369 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Note — The Bun.file and Bun.write APIs documented on this page are heavily optimized and represent the recommended way to perform file-system tasks using Bun. For operations that are not yet available with Bun.file, such as mkdir or readdir, you can use Bun's nearly complete implementation of the node:fs module.

{% /callout %}

Bun provides a set of optimized APIs for reading and writing files.

Reading files (Bun.file())

Bun.file(path): BunFile

Create a BunFile instance with the Bun.file(path) function. A BunFile represents a lazily-loaded file; initializing it does not actually read the file from disk.

const foo = Bun.file("foo.txt"); // relative to cwd
foo.size; // number of bytes
foo.type; // MIME type

The reference conforms to the Blob interface, so the contents can be read in various formats.

const foo = Bun.file("foo.txt");

await foo.text(); // contents as a string
await foo.stream(); // contents as ReadableStream
await foo.arrayBuffer(); // contents as ArrayBuffer
await foo.bytes(); // contents as Uint8Array

File references can also be created using numerical file descriptors or file:// URLs.

Bun.file(1234);
Bun.file(new URL(import.meta.url)); // reference to the current file

A BunFile can point to a location on disk where a file does not exist.

const notreal = Bun.file("notreal.txt");
notreal.size; // 0
notreal.type; // "text/plain;charset=utf-8"
const exists = await notreal.exists(); // false

The default MIME type is text/plain;charset=utf-8, but it can be overridden by passing a second argument to Bun.file.

const notreal = Bun.file("notreal.json", { type: "application/json" });
notreal.type; // => "application/json;charset=utf-8"

For convenience, Bun exposes stdin, stdout and stderr as instances of BunFile.

Bun.stdin; // readonly
Bun.stdout;
Bun.stderr;

Read the full file on GitHub · 369 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 369 lines · 2,169 tokens per session scan C 46bab1907fd6

Subscribe to this mod's changes

bun-file is a cursor rule published in the GitHub repository takuya0206/bigquery-mcp-server (5 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,169 tokens. A static security scan graded it C with 1 finding (hidden instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.