Skip to main content

Module file

Module file 

Source
Expand description

Simple File I/O Operations

Provides synchronous file read/write operations for simple use cases. For async operations or more advanced file handling, use the fs module with the Vfs trait.

§Features

Requires the persistence feature.

§Platform Support

  • Native: Full support via std::fs
  • WASM: Not available (use OPFS via the fs module instead)

§Example

use logicaffeine_system::file;

// Write a file
file::write("data.txt".to_string(), "Hello, World!".to_string())?;

// Read it back
let content = file::read("data.txt".to_string())?;
assert_eq!(content, "Hello, World!");

Functions§

read
Reads a file as a UTF-8 string.
write
Writes a string to a file.