NovelIO


File

Namespace: NovelFS.NovelIO

Provides functions relating to the creating, copying, deleting, moving, opening and reading of files

Nested types and modules

ModuleDescription
Open

Options for opening a file

Path

Operations on File Paths

Functions and values

Function or valueDescription
appendLines lines filename
Signature: lines:seq<string> -> filename:FilePath -> IO<unit>

Appends lines to a file, and then closes the file. If the specified file does not exist, this function creates a file, writes the specified lines to the file and then closes the file.

copy sourceFile destFile
Signature: sourceFile:FilePath -> destFile:FilePath -> IO<unit>

Copies an existing file to a location specified. Overwriting is not allowed

creationTime filename
Signature: filename:FilePath -> IO<DateTime>

Determines the creation date / time of the specified file

creationTimeUTC filename
Signature: filename:FilePath -> IO<DateTime>

Determines the UTC creation date / time of the specified file

delete filename
Signature: filename:FilePath -> IO<unit>

Deletes the specified file

exists filename
Signature: filename:FilePath -> IO<bool>

Determines whether or not the specified file exists

isReadOnly filename
Signature: filename:FilePath -> IO<bool>

Determines whether or not the specified file is readonly

lastAccessTime filename
Signature: filename:FilePath -> IO<DateTime>

Determines the date / time at which the specified file was last accessed

lastAccessTimeUTC filename
Signature: filename:FilePath -> IO<DateTime>

Determines the UTC date / time at which the specified file was last accessed

lastWriteTime filename
Signature: filename:FilePath -> IO<DateTime>

Determines the date / time at which the specified file was last written

lastWriteTimeUTC filename
Signature: filename:FilePath -> IO<DateTime>

Determines the UTC date / time at which the specified file was last written

move sourceFile destFile
Signature: sourceFile:FilePath -> destFile:FilePath -> IO<unit>

Moves an existing file to a location specified. Overwriting is not allowed

openBinaryChannel options fName
Signature: options:FileOpenOptions -> fName:FilePath -> IO<BChannel>

Opens a channel to the specified file using the supplied file mode

openTextChannel options fName
Signature: options:FileOpenOptions -> fName:FilePath -> IO<TChannel>

Opens a channel to the specified file using the supplied file mode

readAllBytes filename
Signature: filename:FilePath -> IO<byte []>

Reads all the bytes from a specified file as an array

readAllLines filename
Signature: filename:FilePath -> IO<string list>

Reads all the lines from a file.

readAllLinesIn encoding filename
Signature: encoding:Encoding -> filename:FilePath -> IO<string list>

Reads all the lines from a file in the supplied encoding.

setCreationTime datetime filename
Signature: datetime:DateTime -> filename:FilePath -> IO<unit>

Sets the date / time at which the specified file was created

setCreationTimeUTC datetime filename
Signature: datetime:DateTime -> filename:FilePath -> IO<unit>

Sets the UTC date / time at which the specified file was created

setLastAccessTime datetime filename
Signature: datetime:DateTime -> filename:FilePath -> IO<unit>

Sets the date / time at which the specified file was last accessed

setLastAccessTimeUTC datetime filename
Signature: datetime:DateTime -> filename:FilePath -> IO<unit>

Sets the UTC date / time at which the specified file was last accessed

setLastWriteTime datetime filename
Signature: datetime:DateTime -> filename:FilePath -> IO<unit>

Sets the date / time at which the specified file was last written

setLastWriteTimeUTC datetime filename
Signature: datetime:DateTime -> filename:FilePath -> IO<unit>

Sets the UTC date / time at which the specified file was last written

size filename
Signature: filename:FilePath -> IO<int64<MeasureProduct<Bytes,MeasureOne>>>

Determines the size of the specified file in bytes

withBinaryChannel options fName fChannel
Signature: options:FileOpenOptions -> fName:FilePath -> fChannel:(BChannel -> IO<'?7497>) -> IO<'?7497>
Type parameters: '?7497

Opens a channel to the specified file using the supplied file mode and performs the supplied computation fChannel with the channel before cleaning it up.

withTextChannel options fName fChannel
Signature: options:FileOpenOptions -> fName:FilePath -> fChannel:(TChannel -> IO<'?7500>) -> IO<'?7500>
Type parameters: '?7500

Opens a channel to the specified file using the supplied file mode and performs the supplied computation fChannel with the channel before cleaning it up.

writeLines lines filename
Signature: lines:seq<string> -> filename:FilePath -> IO<unit>

Creates a new file, writes the specified lines to the file and then closes the file.

Fork me on GitHub