         }
         libssh2_sftp_close_handle(sftpHandle)
     }
-    
 }

public class SFTP {
    private let sftpSession: OpaquePointer
    
    public init(cSession: OpaquePointer) throws {
        guard let sftpSession = libssh2_sftp_init(cSession) else {
            throw LibSSH2Error(code: -1, message: "libssh2_sftp_init failed")

            throw LibSSH2Error(code: -1, message: "libssh2_sftp_open_ex failed")
        }
        
        let data = try Data(contentsOf: localUrl, options: .alwaysMapped)
        
        var offset = 0
        while offset < data.count {
            let upTo = Swift.min(offset + SFTP.bufferSize, data.count)
            let subdata = data.subdata(in: offset ..< upTo)
            if subdata.count > 0 {
                let bytesSent = try subdata.withUnsafeBytes { (pointer: UnsafePointer<Int8>) -> Int in
