Expand description
File I/O Operations for Seq
Provides file reading operations for Seq programs.
§Usage from Seq
"config.json" file-slurp # ( String -- String ) read entire file
"config.json" file-exists? # ( String -- Int ) 1 if exists, 0 otherwise
"data.txt" [ process-line ] file-for-each-line+ # ( String Quotation -- String Int )§Example
: main ( -- Int )
"config.json" file-exists? if
"config.json" file-slurp write_line
else
"File not found" write_line
then
0
;Re-exports§
pub use patch_seq_dir_delete as dir_delete;pub use patch_seq_dir_exists as dir_exists;pub use patch_seq_dir_list as dir_list;pub use patch_seq_dir_make as dir_make;pub use patch_seq_file_append as file_append;pub use patch_seq_file_delete as file_delete;pub use patch_seq_file_exists as file_exists;pub use patch_seq_file_for_each_line_plus as file_for_each_line_plus;pub use patch_seq_file_size as file_size;pub use patch_seq_file_slurp as file_slurp;pub use patch_seq_file_spit as file_spit;
Functions§
- patch_
seq_ ⚠dir_ delete - Delete an empty directory
- patch_
seq_ ⚠dir_ exists - Check if a directory exists
- patch_
seq_ ⚠dir_ list - List directory contents
- patch_
seq_ ⚠dir_ make - Create a directory (and parent directories if needed)
- patch_
seq_ ⚠file_ append - Append string to file (creates if doesn’t exist)
- patch_
seq_ ⚠file_ delete - Delete a file
- patch_
seq_ ⚠file_ exists - Check if a file exists
- patch_
seq_ ⚠file_ for_ each_ line_ plus - Process each line of a file with a quotation
- patch_
seq_ ⚠file_ size - Get file size in bytes
- patch_
seq_ ⚠file_ slurp - Read entire file contents as a string
- patch_
seq_ ⚠file_ spit - Write string to file (creates or overwrites)