flix

0.54.0

Files

Type Aliases

type alias StatInfo = { accessTime = Int64, creationTime = Int64, fileType = FileType, modificationTime = Int64, size = Int64 } Source

Statistical information for a file.

Definitions

def accessTime(f: String): Result[IOError, Int64] \ IO Source

Returns the last access time of the given file f in milliseconds.

def append(f: String, data: t): Result[IOError, Bool] \ IO with ToString[t] Source

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] Source

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: String, data: m[String]): Result[IOError, Bool] \ IO + Aef[m] with Foldable[m] Source

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[IOError, Unit] \ IO Source

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: - 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 Source

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: - 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 Source

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[IOError, Int64] \ IO Source

Returns the creation time of the given file f in milliseconds.

def delete(f: String): Result[IOError, Unit] \ IO Source

Deletes the given file or directory f.

If f is a directory it must be empty.

def deleteIfExists(f: String): Result[IOError, Bool] \ IO Source

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[IOError, Bool] \ IO Source

Returns true if the given file f exists.

def fileType(f: String): Result[IOError, FileType] \ IO Source

Returns the type of the given file f.

def isDirectory(f: String): Result[IOError, Bool] \ IO Source

Returns true is the given file f is a directory.

def isExecutable(f: String): Result[IOError, Bool] \ IO Source

Returns true if the given file f is executable.

def isReadable(f: String): Result[IOError, Bool] \ IO Source

Returns true if the given file f is readable.

def isRegularFile(f: String): Result[IOError, Bool] \ IO Source

Returns true if the given file f is a regular file.

def isWritable(f: String): Result[IOError, Bool] \ IO Source

Returns true if the given file f is writable.

def list(f: String): Result[IOError, List[String]] \ IO Source

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(rc: Region[r], f: String): Result[IOError, Iterator[String, r, r]] \ IO Source

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[IOError, Bool] \ IO Source

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[IOError, Bool] \ IO Source

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[IOError, Int64] \ IO Source

Returns the last-modified timestamp of the given file f in milliseconds

def move(src: { src = String }, dst: String): Result[IOError, Unit] \ IO Source

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: - 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 Source

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: - 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 Source

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[IOError, String] \ IO Source

Returns a string containing the given file f.

def readBytes(_rc: Region[r], f: String): Result[IOError, Array[Int8, r]] \ r + IO Source

Returns 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 Source

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(rc: Region[r], chunkSize: Int32, f: String): Iterator[Result[IOError, Array[Int8, r]], IO + r, r] \ IO + r Source

Returns an iterator of the bytes in the given file in chunks of size chunkSize.

def readLines(f: String): Result[IOError, List[String]] \ IO Source

Returns 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 Source

Returns 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 Source

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[IOError, List[String]] \ IO Source

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[IOError, String] \ IO Source

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[IOError, Int64] \ IO Source

Returns the size of the given file f in bytes.

def stat(f: String): Result[IOError, StatInfo] \ IO Source

Returns the statistics of the given file f.

def truncate(f: String): Result[IOError, Bool] \ IO Source

Returns 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 Source

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(f: String, data: t): Result[IOError, Bool] \ IO with ToString[t] Source

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: String, data: m[Int8]): Result[IOError, Bool] \ IO + Aef[m] with Foldable[m] Source

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: String, data: f[String]): Result[IOError, Bool] \ IO + Aef[f] with Foldable[f] Source

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.