Instance Methodorlandos-nl.citadel 0.8.0Citadel
remove(at:)
Remove a file at the specified path on the SFTP server
SFTPClient.swift:242func remove(at filePath: String) async throws
Other members in extension
Instance members
var eventLoop: EventLoop
The SFTP client’s event loop.
var isActive: Bool
True if the SFTP connection is still open, false otherwise.
let logger: Logger
What it says on the tin.
func createDirectory(atPath: String, attributes: SFTPFileAttributes
) async throws Create a directory at the specified path on the SFTP server. If the directory already exists, an error is thrown.
func getAttributes(at: String
) async throws -> SFTPFileAttributes Get the attributes of a file on the SFTP server. If the file does not exist, an error is thrown.
func listDirectory(atPath: String
) async throws -> [SFTPMessage.Name] List the contents of a directory on the SFTP server.
func openFile(filePath: String, flags: SFTPOpenFileFlags, attributes: SFTPFileAttributes
) async throws -> SFTPFile Open a file at the specified path on the SFTP server, using the given flags and attributes. If the
.create
flag is specified, the given attributes are applied to the created file. If successful, anSFTPFile
is returned which can be used to perform various operations on the open file. The file object must be explicitly closed by the caller; the client does not keep track of open files.func rename(at: String, to: String, flags: UInt32
) async throws Rename a file
func rmdir(at: String
) async throws Remove a directory at the specified path on the SFTP server
func withFile<R>(filePath: String, flags: SFTPOpenFileFlags, attributes: SFTPFileAttributes, @escaping (SFTPFile) async throws -> R
) async throws -> R Open a file at the specified path on the SFTP server, using the given flags. If the
.create
flag is specified, the given attributes are applied to the created file. If the open succeeds, the provided closure is invoked with anSFTPFile
object which can be used to perform operations on the file. When the closure returns, the file is automatically closed. TheSFTPFile
object must not be persisted beyond the lifetime of the closure.