FileSystemModule

PackageAxial.FileSystem

FileSystem

IFileSystem makes file access an explicit, mockable dependency. Every operation returns Flow<'env, FileSystemError, _> and fails with FileSystemError rather than throwing. Read the FileSystem guide for supplying the service and representative usage; this page is the operation catalog.

Whole-file reads and writes

Whole-file reads and writes come in text, line, and byte forms, each with an encoding-explicit and an asynchronous variant: readAllTextWithEncoding, readAllTextAsync, readAllBytes, writeAllBytes, and the rest of the readAllText, readAllLines, writeAllLines, writeAllText, appendAllText, and appendAllLines family.

The Async members on IFileSystem (including ReadAllTextAsync, ReadAllBytesAsync, and WriteAllTextAsync) have signatures such as ReadAllTextAsync : path: string -> Flow<unit, FileSystemError, string> — no token argument, and an environment type of unit. The FileSystem module functions you call from a workflow (FileSystem.readAllTextAsync, FileSystem.readAllBytesAsync, FileSystem.writeAllTextAsync, and the rest) wrap those members, so they return Flow<'env, FileSystemError, _> with when 'env :> IHasFileSystem. The runtime passes its cancellation token to the underlying I/O, so interrupting a workflow stops a large read in progress.

Files and metadata

fileExists, exists, deleteFile, copyFile, and moveFile cover the other common operations. getFileLength returns a file's size in bytes. File metadata has getters and setters for attributes and the creation, last-access, and last-write times in both local and UTC forms, such as getFileLastWriteTimeUtc, setFileAttributes, and so on.

Symbolic links are first class: createFileSymbolicLink, createDirectorySymbolicLink, getSymbolicLinkTarget (which returns None when the path is not a link), and resolveSymbolicLinkTarget, whose boolean argument decides whether to follow the whole chain or stop at the immediate target.

Streams and scopes

openRead, openText, openWrite, createFile, createText, appendText, and the openFile family return open handles. Acquire open handles inside a scope to ensure disposal; see scopes and resources.

Directories and paths

createDirectory creates missing parents. deleteDirectory path recursive takes the recursion flag explicitly, so a recursive delete is visible at the call site. Listing comes in eager (getFiles, getDirectories, getFileSystemEntries) and lazy (enumerateFiles, enumerateDirectories, enumerateFileSystemEntries) forms, each taking a search pattern and a SearchOption. enumerateFileSystemInfos directory pattern searchOption yields FileSystemEntry values with path, kind, size, and timestamps in one listing, avoiding separate metadata calls per entry.

Path manipulation is also on the service: combine, getFullPath, getFileName, getExtension, getRelativePath, getTempPath, getRandomFileName, and the rest. These are pure string operations on .NET, but routing them through the service keeps platform-specific separator and rooting behaviour substitutable in tests.

Summary

NameSignatureSynopsis
Operations
serviceFileSystem.service Reads the file-system service from the environment.
readAllTextFileSystem.readAllText pathReads all text through an explicit file-system service.
readAllTextWithEncodingFileSystem.readAllTextWithEncoding encoding pathReads all text with the specified encoding through an explicit file-system service.
readAllTextAsyncFileSystem.readAllTextAsync pathAsynchronously reads all text through an explicit file-system service.
readAllLinesFileSystem.readAllLines pathReads all lines through an explicit file-system service.
readAllLinesWithEncodingFileSystem.readAllLinesWithEncoding encoding pathReads all lines with the specified encoding through an explicit file-system service.
readAllLinesAsyncFileSystem.readAllLinesAsync pathAsynchronously reads all lines through an explicit file-system service.
readAllBytesFileSystem.readAllBytes pathReads all bytes through an explicit file-system service.
readAllBytesAsyncFileSystem.readAllBytesAsync pathAsynchronously reads all bytes through an explicit file-system service.
writeAllTextFileSystem.writeAllText path contentsWrites all text through an explicit file-system service.
writeAllTextWithEncodingFileSystem.writeAllTextWithEncoding encoding path contentsWrites all text with the specified encoding through an explicit file-system service.
writeAllTextAsyncFileSystem.writeAllTextAsync path contentsAsynchronously writes all text through an explicit file-system service.
writeAllLinesFileSystem.writeAllLines path contentsWrites all lines through an explicit file-system service.
writeAllLinesWithEncodingFileSystem.writeAllLinesWithEncoding encoding path contentsWrites all lines with the specified encoding through an explicit file-system service.
writeAllLinesAsyncFileSystem.writeAllLinesAsync path contentsAsynchronously writes all lines through an explicit file-system service.
writeAllBytesFileSystem.writeAllBytes path contentsWrites all bytes through an explicit file-system service.
writeAllBytesAsyncFileSystem.writeAllBytesAsync path contentsAsynchronously writes all bytes through an explicit file-system service.
appendAllTextFileSystem.appendAllText path contentsAppends all text through an explicit file-system service.
appendAllTextWithEncodingFileSystem.appendAllTextWithEncoding encoding path contentsAppends all text with the specified encoding through an explicit file-system service.
appendAllTextAsyncFileSystem.appendAllTextAsync path contentsAsynchronously appends all text through an explicit file-system service.
appendAllLinesFileSystem.appendAllLines path contentsAppends all lines through an explicit file-system service.
appendAllLinesWithEncodingFileSystem.appendAllLinesWithEncoding encoding path contentsAppends all lines with the specified encoding through an explicit file-system service.
fileExistsFileSystem.fileExists pathChecks file existence through an explicit file-system service.
existsFileSystem.exists pathChecks file existence through an explicit file-system service.
deleteFileFileSystem.deleteFile pathDeletes a file through an explicit file-system service.
copyFileFileSystem.copyFile sourcePath destinationPath overwriteCopies a file through an explicit file-system service.
moveFileFileSystem.moveFile sourcePath destinationPath overwriteMoves a file through an explicit file-system service.
createFileSymbolicLinkFileSystem.createFileSymbolicLink linkPath targetPathCreates a symbolic link to a file through an explicit file-system service.
createDirectorySymbolicLinkFileSystem.createDirectorySymbolicLink linkPath targetPathCreates a symbolic link to a directory through an explicit file-system service.
getSymbolicLinkTargetFileSystem.getSymbolicLinkTarget pathReturns the immediate target stored in a symbolic link.
resolveSymbolicLinkTargetFileSystem.resolveSymbolicLinkTarget returnFinalTarget pathResolves a symbolic link target, optionally following the complete chain.
openFileFileSystem.openFile mode pathOpens a file with the specified mode through an explicit file-system service.
openFileWithAccessFileSystem.openFileWithAccess mode access pathOpens a file with the specified mode and access through an explicit file-system service.
openFileWithShareFileSystem.openFileWithShare mode access share pathOpens a file with the specified mode, access, and sharing behavior through an explicit file-system service.
openReadFileSystem.openRead pathOpens a file for reading through an explicit file-system service.
openTextFileSystem.openText pathOpens a text reader through an explicit file-system service.
openWriteFileSystem.openWrite pathOpens a file for writing through an explicit file-system service.
createFileFileSystem.createFile pathCreates or overwrites a file through an explicit file-system service.
createTextFileSystem.createText pathCreates a text writer through an explicit file-system service.
appendTextFileSystem.appendText pathCreates an append text writer through an explicit file-system service.
getFileLengthFileSystem.getFileLength pathGets the size of a file in bytes through an explicit file-system service.
getFileAttributesFileSystem.getFileAttributes pathGets file attributes through an explicit file-system service.
setFileAttributesFileSystem.setFileAttributes path attributesSets file attributes through an explicit file-system service.
getFileCreationTimeFileSystem.getFileCreationTime pathGets file creation time through an explicit file-system service.
getFileCreationTimeUtcFileSystem.getFileCreationTimeUtc pathGets file creation time in UTC through an explicit file-system service.
setFileCreationTimeFileSystem.setFileCreationTime path timeSets file creation time through an explicit file-system service.
setFileCreationTimeUtcFileSystem.setFileCreationTimeUtc path timeSets file creation time in UTC through an explicit file-system service.
getFileLastAccessTimeFileSystem.getFileLastAccessTime pathGets file last access time through an explicit file-system service.
getFileLastAccessTimeUtcFileSystem.getFileLastAccessTimeUtc pathGets file last access time in UTC through an explicit file-system service.
setFileLastAccessTimeFileSystem.setFileLastAccessTime path timeSets file last access time through an explicit file-system service.
setFileLastAccessTimeUtcFileSystem.setFileLastAccessTimeUtc path timeSets file last access time in UTC through an explicit file-system service.
getFileLastWriteTimeFileSystem.getFileLastWriteTime pathGets file last write time through an explicit file-system service.
getFileLastWriteTimeUtcFileSystem.getFileLastWriteTimeUtc pathGets file last write time in UTC through an explicit file-system service.
setFileLastWriteTimeFileSystem.setFileLastWriteTime path timeSets file last write time through an explicit file-system service.
setFileLastWriteTimeUtcFileSystem.setFileLastWriteTimeUtc path timeSets file last write time in UTC through an explicit file-system service.
directoryExistsFileSystem.directoryExists pathChecks directory existence through an explicit file-system service.
createDirectoryFileSystem.createDirectory pathCreates a directory through an explicit file-system service.
deleteDirectoryFileSystem.deleteDirectory path recursiveDeletes a directory through an explicit file-system service.
moveDirectoryFileSystem.moveDirectory sourcePath destinationPathMoves a directory through an explicit file-system service.
enumerateFilesFileSystem.enumerateFiles path searchPattern searchOptionEnumerates files through an explicit file-system service.
getFilesFileSystem.getFiles path searchPattern searchOptionGets files through an explicit file-system service.
enumerateDirectoriesFileSystem.enumerateDirectories path searchPattern searchOptionEnumerates directories through an explicit file-system service.
getDirectoriesFileSystem.getDirectories path searchPattern searchOptionGets directories through an explicit file-system service.
enumerateFileSystemEntriesFileSystem.enumerateFileSystemEntries path searchPattern searchOptionEnumerates files and directories through an explicit file-system service.
enumerateFileSystemInfosFileSystem.enumerateFileSystemInfos path searchPattern searchOptionEnumerates files and directories with metadata through the file-system service.
getFileSystemEntriesFileSystem.getFileSystemEntries path searchPattern searchOptionGets files and directories through an explicit file-system service.
getLogicalDrivesFileSystem.getLogicalDrives Gets logical drives through an explicit file-system service.
getDirectoryRootFileSystem.getDirectoryRoot pathGets the directory root through an explicit file-system service.
getParentFileSystem.getParent pathGets the parent directory through an explicit file-system service.
getCurrentDirectoryFileSystem.getCurrentDirectory Gets the current working directory through an explicit file-system service.
setCurrentDirectoryFileSystem.setCurrentDirectory pathSets the current working directory through an explicit file-system service.
getDirectoryCreationTimeFileSystem.getDirectoryCreationTime pathGets directory creation time through an explicit file-system service.
getDirectoryCreationTimeUtcFileSystem.getDirectoryCreationTimeUtc pathGets directory creation time in UTC through an explicit file-system service.
setDirectoryCreationTimeFileSystem.setDirectoryCreationTime path timeSets directory creation time through an explicit file-system service.
setDirectoryCreationTimeUtcFileSystem.setDirectoryCreationTimeUtc path timeSets directory creation time in UTC through an explicit file-system service.
getDirectoryLastAccessTimeFileSystem.getDirectoryLastAccessTime pathGets directory last access time through an explicit file-system service.
getDirectoryLastAccessTimeUtcFileSystem.getDirectoryLastAccessTimeUtc pathGets directory last access time in UTC through an explicit file-system service.
setDirectoryLastAccessTimeFileSystem.setDirectoryLastAccessTime path timeSets directory last access time through an explicit file-system service.
setDirectoryLastAccessTimeUtcFileSystem.setDirectoryLastAccessTimeUtc path timeSets directory last access time in UTC through an explicit file-system service.
getDirectoryLastWriteTimeFileSystem.getDirectoryLastWriteTime pathGets directory last write time through an explicit file-system service.
getDirectoryLastWriteTimeUtcFileSystem.getDirectoryLastWriteTimeUtc pathGets directory last write time in UTC through an explicit file-system service.
setDirectoryLastWriteTimeFileSystem.setDirectoryLastWriteTime path timeSets directory last write time through an explicit file-system service.
setDirectoryLastWriteTimeUtcFileSystem.setDirectoryLastWriteTimeUtc path timeSets directory last write time in UTC through an explicit file-system service.
combineFileSystem.combine pathsCombines path segments through an explicit file-system service.
changeExtensionFileSystem.changeExtension path extensionChanges a path extension through an explicit file-system service.
getDirectoryNameFileSystem.getDirectoryName pathGets the directory name for a path through an explicit file-system service.
getInvalidFileNameCharsFileSystem.getInvalidFileNameChars Gets invalid file-name characters through an explicit file-system service.
getInvalidPathCharsFileSystem.getInvalidPathChars Gets invalid path characters through an explicit file-system service.
getExtensionFileSystem.getExtension pathGets the extension for a path through an explicit file-system service.
getFileNameFileSystem.getFileName pathGets the file name for a path through an explicit file-system service.
getFileNameWithoutExtensionFileSystem.getFileNameWithoutExtension pathGets the file name without extension for a path through an explicit file-system service.
getFullPathFileSystem.getFullPath pathGets the full path through an explicit file-system service.
getPathRootFileSystem.getPathRoot pathGets the path root through an explicit file-system service.
getRelativePathFileSystem.getRelativePath relativeTo pathGets a relative path through an explicit file-system service.
getTempPathFileSystem.getTempPath Gets the temporary directory path through an explicit file-system service.
getTempFileNameFileSystem.getTempFileName Creates a temporary file through an explicit file-system service and returns its path.
getRandomFileNameFileSystem.getRandomFileName Gets a random file name through an explicit file-system service.
hasExtensionFileSystem.hasExtension pathChecks whether a path has an extension through an explicit file-system service.
endsInDirectorySeparatorFileSystem.endsInDirectorySeparator pathChecks whether a path ends in a directory separator through an explicit file-system service.
trimEndingDirectorySeparatorFileSystem.trimEndingDirectorySeparator pathTrims one trailing directory separator through an explicit file-system service.
isPathFullyQualifiedFileSystem.isPathFullyQualified pathChecks whether a path is fully qualified through an explicit file-system service.
isPathRootedFileSystem.isPathRooted pathChecks whether a path is rooted through an explicit file-system service.
liveFileSystem.live Creates a live file-system service backed by File, Directory, and Path.
testFileSystem.test ()Creates an empty in-memory file-system test double; seed via the TestFileSystem constructor.

Operations

kind:member

service

FileSystem.service
Member
Reads the file-system service from the environment.

Returns

Flow<'env, 'error, IFileSystem>
kind:member

readAllText

FileSystem.readAllText path
Member
Reads all text through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string>
kind:member

readAllTextWithEncoding

FileSystem.readAllTextWithEncoding encoding path
Member
Reads all text with the specified encoding through an explicit file-system service.

Parameters

NameTypeDescription
encodingEncoding
pathstring

Returns

Flow<'env, FileSystemError, string>
kind:member

readAllTextAsync

FileSystem.readAllTextAsync path
Member
Asynchronously reads all text through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string>
kind:member

readAllLines

FileSystem.readAllLines path
Member
Reads all lines through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string array>
kind:member

readAllLinesWithEncoding

FileSystem.readAllLinesWithEncoding encoding path
Member
Reads all lines with the specified encoding through an explicit file-system service.

Parameters

NameTypeDescription
encodingEncoding
pathstring

Returns

Flow<'env, FileSystemError, string array>
kind:member

readAllLinesAsync

FileSystem.readAllLinesAsync path
Member
Asynchronously reads all lines through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string array>
kind:member

readAllBytes

FileSystem.readAllBytes path
Member
Reads all bytes through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, byte array>
kind:member

readAllBytesAsync

FileSystem.readAllBytesAsync path
Member
Asynchronously reads all bytes through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, byte array>
kind:member

writeAllText

FileSystem.writeAllText path contents
Member
Writes all text through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
contentsstring

Returns

Flow<'env, FileSystemError, unit>
kind:member

writeAllTextWithEncoding

FileSystem.writeAllTextWithEncoding encoding path contents
Member
Writes all text with the specified encoding through an explicit file-system service.

Parameters

NameTypeDescription
encodingEncoding
pathstring
contentsstring

Returns

Flow<'env, FileSystemError, unit>
kind:member

writeAllTextAsync

FileSystem.writeAllTextAsync path contents
Member
Asynchronously writes all text through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
contentsstring

Returns

Flow<'env, FileSystemError, unit>
kind:member

writeAllLines

FileSystem.writeAllLines path contents
Member
Writes all lines through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
contentsstring seq

Returns

Flow<'env, FileSystemError, unit>
kind:member

writeAllLinesWithEncoding

FileSystem.writeAllLinesWithEncoding encoding path contents
Member
Writes all lines with the specified encoding through an explicit file-system service.

Parameters

NameTypeDescription
encodingEncoding
pathstring
contentsstring seq

Returns

Flow<'env, FileSystemError, unit>
kind:member

writeAllLinesAsync

FileSystem.writeAllLinesAsync path contents
Member
Asynchronously writes all lines through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
contentsstring seq

Returns

Flow<'env, FileSystemError, unit>
kind:member

writeAllBytes

FileSystem.writeAllBytes path contents
Member
Writes all bytes through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
contentsbyte array

Returns

Flow<'env, FileSystemError, unit>
kind:member

writeAllBytesAsync

FileSystem.writeAllBytesAsync path contents
Member
Asynchronously writes all bytes through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
contentsbyte array

Returns

Flow<'env, FileSystemError, unit>
kind:member

appendAllText

FileSystem.appendAllText path contents
Member
Appends all text through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
contentsstring

Returns

Flow<'env, FileSystemError, unit>
kind:member

appendAllTextWithEncoding

FileSystem.appendAllTextWithEncoding encoding path contents
Member
Appends all text with the specified encoding through an explicit file-system service.

Parameters

NameTypeDescription
encodingEncoding
pathstring
contentsstring

Returns

Flow<'env, FileSystemError, unit>
kind:member

appendAllTextAsync

FileSystem.appendAllTextAsync path contents
Member
Asynchronously appends all text through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
contentsstring

Returns

Flow<'env, FileSystemError, unit>
kind:member

appendAllLines

FileSystem.appendAllLines path contents
Member
Appends all lines through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
contentsstring seq

Returns

Flow<'env, FileSystemError, unit>
kind:member

appendAllLinesWithEncoding

FileSystem.appendAllLinesWithEncoding encoding path contents
Member
Appends all lines with the specified encoding through an explicit file-system service.

Parameters

NameTypeDescription
encodingEncoding
pathstring
contentsstring seq

Returns

Flow<'env, FileSystemError, unit>
kind:member

fileExists

FileSystem.fileExists path
Member
Checks file existence through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, bool>
kind:member

exists

FileSystem.exists path
Member
Checks file existence through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, bool>
kind:member

deleteFile

FileSystem.deleteFile path
Member
Deletes a file through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, unit>
kind:member

copyFile

FileSystem.copyFile sourcePath destinationPath overwrite
Member
Copies a file through an explicit file-system service.

Parameters

NameTypeDescription
sourcePathstring
destinationPathstring
overwritebool

Returns

Flow<'env, FileSystemError, unit>
kind:member

moveFile

FileSystem.moveFile sourcePath destinationPath overwrite
Member
Moves a file through an explicit file-system service.

Parameters

NameTypeDescription
sourcePathstring
destinationPathstring
overwritebool

Returns

Flow<'env, FileSystemError, unit>
kind:member
FileSystem.createFileSymbolicLink linkPath targetPath
Member
Creates a symbolic link to a file through an explicit file-system service.

Parameters

NameTypeDescription
linkPathstring
targetPathstring

Returns

Flow<'env, FileSystemError, unit>

Verification Examples

FileSystem.createFileSymbolicLink "current.json" "releases/v2.json"
kind:member
FileSystem.createDirectorySymbolicLink linkPath targetPath
Member
Creates a symbolic link to a directory through an explicit file-system service.

Parameters

NameTypeDescription
linkPathstring
targetPathstring

Returns

Flow<'env, FileSystemError, unit>

Verification Examples

FileSystem.createDirectorySymbolicLink "current" "releases/v2"
kind:member

getSymbolicLinkTarget

FileSystem.getSymbolicLinkTarget path
Member
Returns the immediate target stored in a symbolic link.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string option>

Verification Examples

FileSystem.getSymbolicLinkTarget "current"
kind:member

resolveSymbolicLinkTarget

FileSystem.resolveSymbolicLinkTarget returnFinalTarget path
Member
Resolves a symbolic link target, optionally following the complete chain.

Parameters

NameTypeDescription
returnFinalTargetbool
pathstring

Returns

Flow<'env, FileSystemError, string option>

Verification Examples

FileSystem.resolveSymbolicLinkTarget true "current"
kind:member

openFile

FileSystem.openFile mode path
Member
Opens a file with the specified mode through an explicit file-system service.

Parameters

NameTypeDescription
modeFileMode
pathstring

Returns

Flow<'env, FileSystemError, FileStream>
kind:member

openFileWithAccess

FileSystem.openFileWithAccess mode access path
Member
Opens a file with the specified mode and access through an explicit file-system service.

Parameters

NameTypeDescription
modeFileMode
accessFileAccess
pathstring

Returns

Flow<'env, FileSystemError, FileStream>
kind:member

openFileWithShare

FileSystem.openFileWithShare mode access share path
Member
Opens a file with the specified mode, access, and sharing behavior through an explicit file-system service.

Parameters

NameTypeDescription
modeFileMode
accessFileAccess
shareFileShare
pathstring

Returns

Flow<'env, FileSystemError, FileStream>
kind:member

openRead

FileSystem.openRead path
Member
Opens a file for reading through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, Stream>
kind:member

openText

FileSystem.openText path
Member
Opens a text reader through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, StreamReader>
kind:member

openWrite

FileSystem.openWrite path
Member
Opens a file for writing through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, Stream>
kind:member

createFile

FileSystem.createFile path
Member
Creates or overwrites a file through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, Stream>
kind:member

createText

FileSystem.createText path
Member
Creates a text writer through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, StreamWriter>
kind:member

appendText

FileSystem.appendText path
Member
Creates an append text writer through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, StreamWriter>
kind:member

getFileLength

FileSystem.getFileLength path
Member
Gets the size of a file in bytes through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, int64>

Verification Examples

let sizeOf path = FileSystem.getFileLength path
kind:member

getFileAttributes

FileSystem.getFileAttributes path
Member
Gets file attributes through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, FileAttributes>
kind:member

setFileAttributes

FileSystem.setFileAttributes path attributes
Member
Sets file attributes through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
attributesFileAttributes

Returns

Flow<'env, FileSystemError, unit>
kind:member

getFileCreationTime

FileSystem.getFileCreationTime path
Member
Gets file creation time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

getFileCreationTimeUtc

FileSystem.getFileCreationTimeUtc path
Member
Gets file creation time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

setFileCreationTime

FileSystem.setFileCreationTime path time
Member
Sets file creation time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

setFileCreationTimeUtc

FileSystem.setFileCreationTimeUtc path time
Member
Sets file creation time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

getFileLastAccessTime

FileSystem.getFileLastAccessTime path
Member
Gets file last access time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

getFileLastAccessTimeUtc

FileSystem.getFileLastAccessTimeUtc path
Member
Gets file last access time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

setFileLastAccessTime

FileSystem.setFileLastAccessTime path time
Member
Sets file last access time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

setFileLastAccessTimeUtc

FileSystem.setFileLastAccessTimeUtc path time
Member
Sets file last access time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

getFileLastWriteTime

FileSystem.getFileLastWriteTime path
Member
Gets file last write time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

getFileLastWriteTimeUtc

FileSystem.getFileLastWriteTimeUtc path
Member
Gets file last write time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

setFileLastWriteTime

FileSystem.setFileLastWriteTime path time
Member
Sets file last write time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

setFileLastWriteTimeUtc

FileSystem.setFileLastWriteTimeUtc path time
Member
Sets file last write time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

directoryExists

FileSystem.directoryExists path
Member
Checks directory existence through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, bool>
kind:member

createDirectory

FileSystem.createDirectory path
Member
Creates a directory through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, unit>
kind:member

deleteDirectory

FileSystem.deleteDirectory path recursive
Member
Deletes a directory through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
recursivebool

Returns

Flow<'env, FileSystemError, unit>
kind:member

moveDirectory

FileSystem.moveDirectory sourcePath destinationPath
Member
Moves a directory through an explicit file-system service.

Parameters

NameTypeDescription
sourcePathstring
destinationPathstring

Returns

Flow<'env, FileSystemError, unit>
kind:member

enumerateFiles

FileSystem.enumerateFiles path searchPattern searchOption
Member
Enumerates files through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
searchPatternstring
searchOptionSearchOption

Returns

Flow<'env, FileSystemError, string seq>
kind:member

getFiles

FileSystem.getFiles path searchPattern searchOption
Member
Gets files through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
searchPatternstring
searchOptionSearchOption

Returns

Flow<'env, FileSystemError, string array>
kind:member

enumerateDirectories

FileSystem.enumerateDirectories path searchPattern searchOption
Member
Enumerates directories through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
searchPatternstring
searchOptionSearchOption

Returns

Flow<'env, FileSystemError, string seq>
kind:member

getDirectories

FileSystem.getDirectories path searchPattern searchOption
Member
Gets directories through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
searchPatternstring
searchOptionSearchOption

Returns

Flow<'env, FileSystemError, string array>
kind:member

enumerateFileSystemEntries

FileSystem.enumerateFileSystemEntries path searchPattern searchOption
Member
Enumerates files and directories through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
searchPatternstring
searchOptionSearchOption

Returns

Flow<'env, FileSystemError, string seq>
kind:member

enumerateFileSystemInfos

FileSystem.enumerateFileSystemInfos path searchPattern searchOption
Member
Enumerates files and directories with metadata through the file-system service.

Parameters

NameTypeDescription
pathstring
searchPatternstring
searchOptionSearchOption

Returns

Flow<'env, FileSystemError, FileSystemEntry seq>
kind:member

getFileSystemEntries

FileSystem.getFileSystemEntries path searchPattern searchOption
Member
Gets files and directories through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
searchPatternstring
searchOptionSearchOption

Returns

Flow<'env, FileSystemError, string array>
kind:member

getLogicalDrives

FileSystem.getLogicalDrives
Member
Gets logical drives through an explicit file-system service.

Returns

Flow<'env, FileSystemError, string array>
kind:member

getDirectoryRoot

FileSystem.getDirectoryRoot path
Member
Gets the directory root through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string>
kind:member

getParent

FileSystem.getParent path
Member
Gets the parent directory through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string option>
kind:member

getCurrentDirectory

FileSystem.getCurrentDirectory
Member
Gets the current working directory through an explicit file-system service.

Returns

Flow<'env, FileSystemError, string>
kind:member

setCurrentDirectory

FileSystem.setCurrentDirectory path
Member
Sets the current working directory through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, unit>
kind:member

getDirectoryCreationTime

FileSystem.getDirectoryCreationTime path
Member
Gets directory creation time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

getDirectoryCreationTimeUtc

FileSystem.getDirectoryCreationTimeUtc path
Member
Gets directory creation time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

setDirectoryCreationTime

FileSystem.setDirectoryCreationTime path time
Member
Sets directory creation time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

setDirectoryCreationTimeUtc

FileSystem.setDirectoryCreationTimeUtc path time
Member
Sets directory creation time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

getDirectoryLastAccessTime

FileSystem.getDirectoryLastAccessTime path
Member
Gets directory last access time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

getDirectoryLastAccessTimeUtc

FileSystem.getDirectoryLastAccessTimeUtc path
Member
Gets directory last access time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

setDirectoryLastAccessTime

FileSystem.setDirectoryLastAccessTime path time
Member
Sets directory last access time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

setDirectoryLastAccessTimeUtc

FileSystem.setDirectoryLastAccessTimeUtc path time
Member
Sets directory last access time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

getDirectoryLastWriteTime

FileSystem.getDirectoryLastWriteTime path
Member
Gets directory last write time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

getDirectoryLastWriteTimeUtc

FileSystem.getDirectoryLastWriteTimeUtc path
Member
Gets directory last write time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, DateTime>
kind:member

setDirectoryLastWriteTime

FileSystem.setDirectoryLastWriteTime path time
Member
Sets directory last write time through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

setDirectoryLastWriteTimeUtc

FileSystem.setDirectoryLastWriteTimeUtc path time
Member
Sets directory last write time in UTC through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
timeDateTime

Returns

Flow<'env, FileSystemError, unit>
kind:member

combine

FileSystem.combine paths
Member
Combines path segments through an explicit file-system service.

Parameters

NameTypeDescription
pathsstring array

Returns

Flow<'env, FileSystemError, string>
kind:member

changeExtension

FileSystem.changeExtension path extension
Member
Changes a path extension through an explicit file-system service.

Parameters

NameTypeDescription
pathstring
extensionstring

Returns

Flow<'env, FileSystemError, string>
kind:member

getDirectoryName

FileSystem.getDirectoryName path
Member
Gets the directory name for a path through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string option>
kind:member

getInvalidFileNameChars

FileSystem.getInvalidFileNameChars
Member
Gets invalid file-name characters through an explicit file-system service.

Returns

Flow<'env, FileSystemError, char array>
kind:member

getInvalidPathChars

FileSystem.getInvalidPathChars
Member
Gets invalid path characters through an explicit file-system service.

Returns

Flow<'env, FileSystemError, char array>
kind:member

getExtension

FileSystem.getExtension path
Member
Gets the extension for a path through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string>
kind:member

getFileName

FileSystem.getFileName path
Member
Gets the file name for a path through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string>
kind:member

getFileNameWithoutExtension

FileSystem.getFileNameWithoutExtension path
Member
Gets the file name without extension for a path through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string>
kind:member

getFullPath

FileSystem.getFullPath path
Member
Gets the full path through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string>
kind:member

getPathRoot

FileSystem.getPathRoot path
Member
Gets the path root through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string option>
kind:member

getRelativePath

FileSystem.getRelativePath relativeTo path
Member
Gets a relative path through an explicit file-system service.

Parameters

NameTypeDescription
relativeTostring
pathstring

Returns

Flow<'env, FileSystemError, string>
kind:member

getTempPath

FileSystem.getTempPath
Member
Gets the temporary directory path through an explicit file-system service.

Returns

Flow<'env, FileSystemError, string>
kind:member

getTempFileName

FileSystem.getTempFileName
Member
Creates a temporary file through an explicit file-system service and returns its path.

Returns

Flow<'env, FileSystemError, string>
kind:member

getRandomFileName

FileSystem.getRandomFileName
Member
Gets a random file name through an explicit file-system service.

Returns

Flow<'env, FileSystemError, string>
kind:member

hasExtension

FileSystem.hasExtension path
Member
Checks whether a path has an extension through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, bool>
kind:member

endsInDirectorySeparator

FileSystem.endsInDirectorySeparator path
Member
Checks whether a path ends in a directory separator through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, bool>
kind:member

trimEndingDirectorySeparator

FileSystem.trimEndingDirectorySeparator path
Member
Trims one trailing directory separator through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, string>
kind:member

isPathFullyQualified

FileSystem.isPathFullyQualified path
Member
Checks whether a path is fully qualified through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, bool>
kind:member

isPathRooted

FileSystem.isPathRooted path
Member
Checks whether a path is rooted through an explicit file-system service.

Parameters

NameTypeDescription
pathstring

Returns

Flow<'env, FileSystemError, bool>
kind:member

live

FileSystem.live
Member
Creates a live file-system service backed by File, Directory, and Path.

Returns

IFileSystem
kind:member

test

FileSystem.test ()
Member
Creates an empty in-memory file-system test double; seed via the TestFileSystem constructor.

Parameters

NameTypeDescription
()unit

Returns

TestFileSystem