Files
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[IOError, Int64] \ IO
SourceReturns the last access time of the given file f
in milliseconds.
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: String, data: m[Int8]): Result[IOError, Bool] \ IO + Aef[m] with Foldable[m]
SourceAppends 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: String, data: m[String]): Result[IOError, Bool] \ IO + Aef[m] with Foldable[m]
SourceAppends 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[IOError, Unit] \ IO
SourceCopies 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:
- dst
already exists, or
- dst
is a subpath of src
, or
- an I/O error occurred.
def copyInto(src: { src = String }, dst: String): Result[IOError, Unit] \ IO
SourceCopies 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:
- src
was not copied, or
- dst
is a subpath of src
, or
- dst
is not a directory, or
- an I/O error occurred.
def copyOver(src: { src = String }, dst: String): Result[IOError, Unit] \ IO
SourceCopies 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[IOError, Int64] \ IO
SourceReturns the creation time of the given file f
in milliseconds.
def delete(f: String): Result[IOError, Unit] \ IO
SourceDeletes the given file or directory f
.
If f
is a directory it must be empty.
def deleteIfExists(f: String): Result[IOError, Bool] \ IO
SourceReturns 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[IOError, Bool] \ IO
SourceReturns true
if the given file f
exists.
def fileType(f: String): Result[IOError, FileType] \ IO
SourceReturns the type of the given file f
.
def isDirectory(f: String): Result[IOError, Bool] \ IO
SourceReturns true
is the given file f
is a directory.
def isExecutable(f: String): Result[IOError, Bool] \ IO
SourceReturns true
if the given file f
is executable.
def isReadable(f: String): Result[IOError, Bool] \ IO
SourceReturns true
if the given file f
is readable.
def isRegularFile(f: String): Result[IOError, Bool] \ IO
SourceReturns true
if the given file f
is a regular file.
def isSymbolicLink(f: String): Result[IOError, Bool] \ IO
SourceReturns true
if the given file f
is a symbolic link.
def isWritable(f: String): Result[IOError, Bool] \ IO
SourceReturns true
if the given file f
is writable.
def list(f: String): Result[IOError, List[String]] \ IO
SourceReturns 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(rc: Region[r], f: String): Result[IOError, Iterator[String, r, r]] \ IO
SourceReturns 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[IOError, Bool] \ IO
SourceCreates 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[IOError, Bool] \ IO
SourceCreates 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[IOError, Int64] \ IO
SourceReturns the last-modified timestamp of the given file f
in milliseconds
def move(src: { src = String }, dst: String): Result[IOError, Unit] \ IO
SourceMoves 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:
- dst
already exists, or
- dst
is a subpath of src
, or
- an I/O error occurred.
def moveInto(src: { src = String }, dst: String): Result[IOError, Unit] \ IO
SourceMoves 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:
- src
was not moved, or
- dst
is a subpath of src
, or
- dst
is not a directory, or
- an I/O error occurred.
def moveOver(src: { src = String }, dst: String): Result[IOError, Unit] \ IO
SourceMoves 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[IOError, String] \ IO
SourceReturns a string containing the given file f
.
def readBytes(_rc: Region[r], f: String): Result[IOError, Array[Int8, r]] \ r + IO
SourceReturns an array of all the bytes in the given file f
.
def readBytesWith(rc: Region[r], opts: { count = Int32, offset = Int64 }, f: String): Result[IOError, Array[Int8, r]] \ r + IO
SourceReturns 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(rc: Region[r], chunkSize: Int32, f: String): Iterator[Result[IOError, Array[Int8, r]], IO + r, r] \ IO + r
SourceReturns an iterator of the bytes in the given file
in chunks of size chunkSize
.
def readLines(f: String): Result[IOError, List[String]] \ IO
SourceReturns a list of all the lines in the given file f
.
def readLinesIter(rc: Region[r], f: String): Iterator[Result[IOError, String], IO + r, r] \ r + IO
SourceReturns an iterator of the given file f
def readLinesIterWith(rc: Region[r], opts: { charSet = String }, f: String): Iterator[Result[IOError, String], IO + r, r] \ r + IO
SourceReturns 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[IOError, List[String]] \ IO
SourceReturns 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[IOError, String] \ IO
SourceReturns 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[IOError, Int64] \ IO
SourceReturns the size of the given file f
in bytes.
def stat(f: String): Result[IOError, StatInfo] \ IO
SourceReturns the statistics of the given file f
.
def truncate(f: String): Result[IOError, Bool] \ IO
SourceReturns true
if the file f
was created, and false
if f
was overwritten.
def walk(rc: Region[r], f: String): Result[IOError, Iterator[String, r, r]] \ IO + r
SourceReturns 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.
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.