bun-file-io

Read, write, scan, and delete files using Bun APIs.

1|Updated Sep 11, 2023
One-click install
npx skills add https://github.com/vcntttt/dotfiles --skill bun-file-io-vcntttt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bun-file-io
Source: https://github.com/vcntttt/dotfiles/tree/main/.agents/skills/bun-file-io
Command: npx skills add https://github.com/vcntttt/dotfiles --skill bun-file-io-vcntttt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill consolidates Bun file I/O practices for reading, writing, scanning, and deleting files. It explains when to use Bun APIs over node:fs and documents patterns for directories and tool integration within this repo.

Core Features & Use Cases

  • Bun.file-based operations: reading text, JSON, and streams; writing via Bun.write; deleting with Bun.file(...).delete().
  • Directory and existence handling: path resolution, exists checks, and error handling.
  • Scanning and automation: using Bun.Glob for file discovery and automated workflows across packages.
  • Use case: orchestrate a build or deployment script that reads a config, updates values, and cleans up temporary files.

Quick Start

Use the bun-file-io skill to read the contents of a file using Bun.file(path).text(), update the data, and perform a cleanup with Bun.file(path).delete().

Frequently Asked Questions about bun-file-io

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I read and write files in Bun safely?

To read and write files in Bun safely, use Bun.file(path).text() for reading and Bun.write() for writing. These native APIs provide streamlined file I/O operations and serve as safe patterns for routine development tasks.

When should I prefer Bun.file over node:fs for file operations?

You should prefer Bun.file over node:fs when working within Bun-based workflows to leverage native performance. This skill specifies exactly when to choose Bun APIs over node:fs for reading configs, scanning directories, and managing files.

What is the best way to scan directories and discover files in Bun?

The best way to scan directories and discover files in Bun is using Bun.Glob. It enables batch scans for file discovery and automates workflows across multiple packages within your repository.

How do I delete temporary files and handle directory existence checks in Bun?

To delete temporary files in Bun, use the Bun.file(path).delete() method. For directory existence checks, the skill documents path resolution and error handling patterns to safely manage and overwrite files.

Can I orchestrate a build script that reads config, updates values, and cleans up files in Bun?

Yes, you can orchestrate build or deployment scripts in Bun by reading a config file with Bun.file, updating the data, and performing a cleanup with Bun.file(path).delete() to safely manage temporary files.