File
Enums
enum FileType with EqOrderToString
SourceFile types.
Type Aliases
type alias StatInfo = { accessTime = Int64, creationTime = Int64, fileType = FileType, modificationTime = Int64, size = Int64 }
SourceStatistical information for a file.
Definitions
def
accessTime
(
f :
String
)
: Result[String, Int64]
\ IO
Returns the last access time of the given file f in milliseconds.
def
append
[t]
(
f :
String
data :
t
)
: Result[String, Bool]
\ IO
with
ToString[t]
Appends data to the given file f.
Returns true if the file f was created, and false if data was appended to an existing f.
def
appendBytes
[f]
(
f :
String
data :
f[Int8]
)
: Result[String, Bool]
\ IO
with
Foldable[f]
Appends data to the given f.
Returns true if the file f was created, and false if data was appended to an existing f.
def
appendLines
[f]
(
f :
String
data :
f[String]
)
: Result[String, Bool]
\ IO
with
Foldable[f]
Appends data to the given file f.
Returns true if the file f was created, and false if data was appended to an existing f.
def
copy
(
src :
{ src = String }
dst :
String
)
: Result[String, Unit]
\ IO
Copies a file or directory from path src to path dst.
Returns Ok(()) if src was copied, and dst did not already exist.
Returns Err(msg) if src was not copied because:
dstalready exists, ordstis a subpath ofsrc, or- an I/O error occurred.
def
copyInto
(
src :
{ src = String }
dst :
String
)
: Result[String, Unit]
\ IO
Copies a file or directory from path src to directory dst.
Returns Ok(()) if src was copied, and dst is a directory.
Returns Err(msg) if:
srcwas not copied, ordstis a subpath ofsrc, ordstis not a directory, or- an I/O error occurred.
def
copyOver
(
src :
{ src = String }
dst :
String
)
: Result[String, Unit]
\ IO
Copies a file or directory from path src to path dst. Overwrites if dst already exists.
Returns Ok(()) if src was copied.
Returns Err(msg) if src was not copied, or an I/O error occurred.
def
creationTime
(
f :
String
)
: Result[String, Int64]
\ IO
Returns the creation time of the given file f in milliseconds.
def
delete
(
f :
String
)
: Result[String, Unit]
\ IO
Deletes the given file or directory f.
If f is a directory it must be empty.
def
deleteIfExists
(
f :
String
)
: Result[String, Bool]
\ IO
Returns true if the given file or directory f was deleted
and false if f was not deleted because it did not exist.
If f is a directory it must be empty.
def
exists
(
f :
String
)
: Result[String, Bool]
\ IO
Returns true if the given file f exists.
def
fileType
(
f :
String
)
: Result[String, FileType]
\ IO
Returns the type of the given file f.
def
isDirectory
(
f :
String
)
: Result[String, Bool]
\ IO
Returns true is the given file f is a directory.
def
isExecutable
(
f :
String
)
: Result[String, Bool]
\ IO
Returns true if the given file f is executable.
def
isReadable
(
f :
String
)
: Result[String, Bool]
\ IO
Returns true if the given file f is readable.
def
isRegularFile
(
f :
String
)
: Result[String, Bool]
\ IO
Returns true if the given file f is a regular file.
def
isSymbolicLink
(
f :
String
)
: Result[String, Bool]
\ IO
Returns true if the given file f is a symbolic link.
def
isWritable
(
f :
String
)
: Result[String, Bool]
\ IO
Returns true if the given file f is writable.
def
list
(
f :
String
)
: Result[String, List[String]]
\ IO
Returns a list naming the files and directories in the directory f.
The full paths of the files and directories are specified.
Does not recursively traverse the directory.
def
listWithIter
[r]
(
rc :
Region[r]
f :
String
)
: Result[String, Iterator[String, r, r]]
\ IO
Returns an Iterator naming the files and directories in the directory f.
The full paths of the files and directories are specified.
Does not recursively traverse the directory.
def
mkdir
(
d :
String
)
: Result[String, Bool]
\ IO
Creates the directory d.
Returns Ok(true) if the directory d was created and did not already exist.
Returns Ok(false) if the directory d already existed and is a directory.
Returns Err(msg) if the directory could not be created.
def
mkdirs
(
d :
String
)
: Result[String, Bool]
\ IO
Creates the directory d along with all necessary parent directories.
Returns Ok(true) if the directory d was created and did not already exist.
Returns Ok(false) if the directory d already existed and is a directory.
Returns Err(msg) if the directory could not be created.
def
modificationTime
(
f :
String
)
: Result[String, Int64]
\ IO
Returns the last-modified timestamp of the given file f in milliseconds
def
move
(
src :
{ src = String }
dst :
String
)
: Result[String, Unit]
\ IO
Moves a file or directory from path src to path dst.
Returns Ok(()) if src was moved, and dst did not already exist.
Returns Err(msg) if src was not moved because:
dstalready exists, ordstis a subpath ofsrc, or- an I/O error occurred.
def
moveInto
(
src :
{ src = String }
dst :
String
)
: Result[String, Unit]
\ IO
Moves a file or directory from path src to directory dst.
Returns Ok(()) if src was moved, and dst is a directory.
Returns Err(msg) if:
srcwas not moved, ordstis a subpath ofsrc, ordstis not a directory, or- an I/O error occurred.
def
moveOver
(
src :
{ src = String }
dst :
String
)
: Result[String, Unit]
\ IO
Moves a file or directory from path src to path dst. Overwrites if dst already exists.
Returns Ok(()) if src was moved.
Returns Err(msg) if src was not moved, or an I/O error occurred.
def
read
(
f :
String
)
: Result[String, String]
\ IO
Returns a string containing the given file f.
def
readBytes
[r]
(
_rc :
Region[r]
f :
String
)
: Result[String, Array[Int8, r]]
\ IO
Returns an array of all the bytes in the given file f.
def
readBytesWith
[r]
(
rc :
Region[r]
opts :
{ count = Int32, offset = Int64 }
f :
String
)
: Result[String, Array[Int8, r]]
\ IO
Returns an array of all the bytes in the given file f and applying the options opts.
The options opts to apply consists of
offset - the start offset in the given file f.
count - the number of bytes read.
def
readChunks
[r]
(
rc :
Region[r]
chunkSize :
Int32
f :
String
)
: Iterator[Result[String, Array[Int8, r]], IO, r]
\ IO
Returns an iterator of the bytes in the given file in chunks of size chunkSize.
def
readLines
(
f :
String
)
: Result[String, List[String]]
\ IO
Returns a list of all the lines in the given file f.
def
readLinesIter
[r]
(
rc :
Region[r]
f :
String
)
: Iterator[Result[String, String], IO, r]
\ IO
Returns an iterator of the given file f
def
readLinesIterWith
[r]
(
rc :
Region[r]
opts :
{ charSet = String }
f :
String
)
: Iterator[Result[String, String], IO, r]
\ IO
Returns an iterator of the given file f with the options opts.
The options opts to apply consists of
charSet - the specific charset to be used to decode the bytes.
def
readLinesWith
(
opts :
{ charSet = String }
f :
String
)
: Result[String, List[String]]
\ IO
Returns a list of all the lines in the given file f with the options opts.
The options opts to apply consists of
charSet - the specific charset to be used to decode the bytes.
def
readWith
(
opts :
{ charSet = String, count = Int32, offset = Int64 }
f :
String
)
: Result[String, String]
\ IO
Returns a string containing the given file f with the options opts.
The options opts to apply consists of
offset - the start offset in the given file f.
count - the number of bytes read.
charSet - the specific charset to be used to decode the bytes.
def
size
(
f :
String
)
: Result[String, Int64]
\ IO
Returns the size of the given file f in bytes.
def
stat
(
f :
String
)
: Result[String, StatInfo]
\ IO
Returns the statistics of the given file f.
def
truncate
(
f :
String
)
: Result[String, Bool]
\ IO
Returns true if the file f was created, and false if f was overwritten.
def
walk
[r]
(
rc :
Region[r]
f :
String
)
: Result[String, Iterator[String, r, r]]
\ IO
Returns an Iterator over the files and directories recursively under the path f, including f itself.
The full paths of the files and directories are specified.
Recursively traverses the directory.
def
write
[t]
(
f :
String
data :
t
)
: Result[String, Bool]
\ IO
with
ToString[t]
Writes data to the given file f.
Creates file f if it does not exist. Overwrites it if it exists.
Returns true if the file was created.
def
writeBytes
[f]
(
f :
String
data :
f[Int8]
)
: Result[String, Bool]
\ IO
with
Foldable[f]
Writes data to the given f.
Creates f if it does not exist. Overwrites it if it exists.
Returns true if the file f was created, and false if f was overwritten.
def
writeLines
[f]
(
f :
String
data :
f[String]
)
: Result[String, Bool]
\ IO
with
Foldable[f]
Writes data to the given f.
Creates f if it does not exist. Overwrites it if it exists.
Returns true if the file f was created, and false if f was overwritten.