fileio

Crates.iofileio
lib.rsfileio
version0.1.0
created_at2025-09-25 11:10:59.794185+00
updated_at2025-09-25 11:10:59.794185+00
descriptionFluent file I/O crate for Rust: read/write/append lines easily, including write_line functionality
homepage
repositoryhttps://github.com/lilcloudcoder/fileio
max_upload_size
id1854486
size6,213
Yogya (LilCloudCoder)

documentation

README

FileIO

Fluent file operations in Rust: read, write, append, replace, or insert lines easily.

Features

  • .read_all() → Read entire file as a String
  • .read_lines() → Read file line by line
  • .append(content) → Append a line at the end
  • .write(content) → Overwrite the whole file
  • .write_line(line_number, content) → Replace a specific line
  • .insert_line(line_number, content) → Insert a line without overwriting

Installation

Add to your Cargo.toml:

[dependencies]
fileio = "...."

Usage:

use fileio::file;

fn main() {
    let f = file("/full/path/to/file/example.txt");

    // Append a line
    f.append("This is a new line!").unwrap();

    // Replace line 2
    f.write_line(2, "Updated line 2").unwrap();

    // Insert a line at line 1
    f.insert_line(1, "Inserted line 1").unwrap();

    // Read and print all lines
    for line in f.read_lines().unwrap() {
        println!("{}", line);
    }

    // Read the entire file as string
    let content = f.read_all().unwrap();
    println!("Whole file:\n{}", content);
}
Commit count: 0

cargo fmt