March Docs

File

File module: filesystem I/O. All I/O functions return Result(value, FileError). Use with_lines / with_chunks for streaming. The file handle is closed when the callback returns and if the callback panics — these wrappers delegate to the runtime try_finally primitive to guarantee cleanup even on unhandled exceptions.

Types

ptypeFileErrorFileError = NotFound(String) | Permission(String) | IsDirectory(String) | NotEmpty(String) | IoError(String)#
ptypeFileKindFileKind = RegularFile | Directory | Symlink | OtherKind#
ptypeFileStatFileStat = FileStat(Int, FileKind, Int, Int)#
ptypeSeqSeq(a) = Seq(a)#

Functions

fnappendappend(path, data) do file_append(path, data) end#
fncopycopy(src, dest) do file_copy(src, dest) end#
fndeletedelete(path) do file_delete(path) end#
fneach_chunkeach_chunk(path, size, f)#
fneach_lineeach_line(path, f)#
fnexistsexists(path)#
fnmtimemtime(path)#
fnreadread(path)#
fnread_linesread_lines(path)#
fnrenamerename(src, dest) do file_rename(src, dest) end#
fnstatstat(path)#
fnwith_chunkswith_chunks(path, size, callback)#
fnwith_lineswith_lines(path, callback)#
fnwritewrite(path, data) do file_write(path, data) end#