File
Trait for handling file operations in Starknet Foundry.
trait FileTrait {
fn new(path: ByteArray) -> File;
}
âšī¸ Info
Specific rules must be followed for snforge to correctly parse JSON and plain text files.
Read file format rules for more.
Example
File content:
'Hello Starknet!'
'Let's code in Cairo!'
"Example byte array"
Test code:
use snforge_std::fs::FileTrait;
#[test]
fn file_trait_example() {
// Create an instance of `File` to be used later
let _file = FileTrait::new("data/hello_starknet.txt");
}