WriteFileHandle
The type of WritableFileHandleProtocol
to return when opening files for writing.
- iOS
- 13.0+
- macOS
- 10.15+
- tvOS
- 13.0+
- watchOS
- 6.0+
associatedtype WriteFileHandle where Self.WriteFileHandle == Self.DirectoryFileHandle.WriteFileHandle
The type of WritableFileHandleProtocol
to return when opening files for writing.
associatedtype WriteFileHandle where Self.WriteFileHandle == Self.DirectoryFileHandle.WriteFileHandle
import _NIOFileSystem
A file system library for Swift.
protocol FileSystemProtocol : Sendable
The interface for interacting with a file system.
protocol WritableFileHandleProtocol : FileHandleProtocol
A file handle suitable for writing.
associatedtype DirectoryFileHandle : DirectoryFileHandleProtocol
The type of DirectoryFileHandleProtocol
to return when opening directories.
associatedtype WriteFileHandle : WritableFileHandleProtocol
The type of WritableFileHandleProtocol
to return when opening files for writing.
associatedtype ReadFileHandle where Self.ReadFileHandle == Self.DirectoryFileHandle.ReadFileHandle
The type of ReadableFileHandleProtocol
to return when opening files for reading.
associatedtype ReadWriteFileHandle where Self.ReadWriteFileHandle == Self.DirectoryFileHandle.ReadWriteFileHandle
The type of ReadableAndWritableFileHandleProtocol
to return when opening files for reading and writing.
var currentWorkingDirectory: FilePath { get async throws }
Returns the current working directory.
var temporaryDirectory: FilePath { get async throws }
Returns the path of the temporary directory.
func copyItem(at sourcePath: FilePath, to destinationPath: FilePath, strategy copyStrategy: CopyStrategy, shouldProceedAfterError: @escaping (DirectoryEntry, any Error) async throws -> Void, shouldCopyItem: @escaping (DirectoryEntry, FilePath) async -> Bool) async throws
Copies the item at the specified path to a new location.
func createDirectory(at path: FilePath, withIntermediateDirectories createIntermediateDirectories: Bool, permissions: FilePermissions?) async throws
Create a directory at the given path.
func createSymbolicLink(at path: FilePath, withDestination destinationPath: FilePath) async throws
Creates a symbolic link that points to the destination.
func createTemporaryDirectory(template: FilePath) async throws -> FilePath
Create a temporary directory at the given path, from a template.
func destinationOfSymbolicLink(at path: FilePath) async throws -> FilePath
Returns the path of the item pointed to by a symbolic link.
func info(forFileAt path: FilePath, infoAboutSymbolicLink: Bool) async throws -> FileInfo?
Returns information about the file at the given path, if it exists; nil otherwise.
func moveItem(at sourcePath: FilePath, to destinationPath: FilePath) async throws
Moves the file or directory at the specified path to a new location.
func openDirectory(atPath path: FilePath, options: OpenOptions.Directory) async throws -> Self.DirectoryFileHandle
Opens the directory at path
and returns a handle to it.
func openFile(forReadingAndWritingAt path: FilePath, options: OpenOptions.Write) async throws -> Self.ReadWriteFileHandle
Opens the file at path
for reading and writing and returns a handle to it.
func openFile(forReadingAt path: FilePath, options: OpenOptions.Read) async throws -> Self.ReadFileHandle
Opens the file at path
for reading and returns a handle to it.
func openFile(forWritingAt path: FilePath, options: OpenOptions.Write) async throws -> Self.WriteFileHandle
Opens the file at path
for writing and returns a handle to it.
@discardableResult func removeItem(at path: FilePath, strategy removalStrategy: RemovalStrategy, recursively removeItemRecursively: Bool) async throws -> Int
Deletes the file or directory (and its contents) at path
.
func replaceItem(at destinationPath: FilePath, withItemAt existingPath: FilePath) async throws
Replaces the item at destinationPath
with the item at existingPath
.