March Docs

File

File module: filesystem I/O. All I/O functions return Result(value, FileError). Use with_lines / with_chunks for streaming (file handle closed after callback returns). Note: if the callback raises an unhandled exception, the handle may leak. March does not have try/finally semantics.

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

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