close

    Close the file. No further operations may take place on the file after it is closed. A file must be closed before the last reference to it goes away.

    SFTPFile.swift:169
    func close() async throws

    Other members in extension

    Typealiases

    Instance members

    • var isActive: Bool

      Indicates whether the file’s handle was still valid at the time the getter was called.

    • var logger: Logging.Logger

      A Logger for the file. Uses the logger of the client that opened the file.

    • func read(from: UInt64, length: UInt32) async throws -> ByteBuffer

      Read up to the given number of bytes from the file, starting at the given byte offset. If the offset is past the last byte of the file, an error will be returned. The offset is a 64-bit quantity, but no more than UInt32.max bytes may be read in a single chunk.

    • func readAll() async throws -> ByteBuffer

      Read all bytes in the file into a single in-memory buffer. Reads are done in chunks of up to 4GB each. For files below that size, use file.read() instead. If an error is encountered during any of the chunk reads, it cancels all remaining reads and discards the buffer.

    • func readAttributes() async throws -> SFTPFileAttributes

      Read the attributes of the file. This is equivalent to the stat() system call.

    • func write(ByteBuffer, at: UInt64) async throws

      Write the given data to the file, starting at the provided offset. If the offset is past the current end of the file, the behavior is server-dependent, but it is safest to assume that this is not permitted. The offset is ignored if the file was opened with the .append flag.