{"action":"created","comment":{"url":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/comments/166670072","pull_request_review_id":94768234,"id":166670072,"diff_hunk":"@@ -11,62 +11,58 @@ import Foundation\n /** Operation for downloading a file from FTP server. */\n internal class FileDownloadOperation: ReadStreamOperation {\n     \n-    private var fileHandle: NSFileHandle?\n-    var fileURL: NSURL?\n+    private var fileHandle: FileHandle?\n+    var fileURL: URL?\n+    var progressHandler: DownloadProgressHandler?\n     \n     override func start() {\n-        let filePath = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent(NSUUID().UUIDString)\n-        fileURL = NSURL(fileURLWithPath: filePath)\n-        guard let fileURL = fileURL else {\n-            error = NSError(domain: \"streamEventError\", code: 1, userInfo: nil)\n-            finishOperation()\n-            return\n-        }\n+        let filePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(path ?? UUID().uuidString)\n+        self.fileURL = URL(fileURLWithPath: filePath)\n         do {\n-            try NSData().writeToURL(fileURL, options: NSDataWritingOptions.DataWritingAtomic)\n-            fileHandle = try NSFileHandle(forWritingToURL: fileURL)\n-            startOperationWithStream(readStream)\n+            try Data().write(to: self.fileURL!, options: NSData.WritingOptions.atomic)\n+            fileHandle = try FileHandle(forWritingTo: self.fileURL!)\n+            startOperationWithStream(self.readStream)\n         } catch let error as NSError {\n             self.error = error\n-            fileHandle = nil\n             finishOperation()\n         }\n     }\n-\n-    override func streamEventEnd(aStream: NSStream) -> (Bool, NSError?) {\n+    \n+    override func streamEventEnd(_ aStream: Stream) -> (Bool, NSError?) {\n         fileHandle?.closeFile()\n         return (true, nil)\n     }\n     \n-    override func streamEventError(aStream: NSStream) {\n+    override func streamEventError(_ aStream: Stream) {\n+        super.streamEventError(aStream)\n         fileHandle?.closeFile()\n-        if let fileURL = fileURL {\n+        if let fileURL = self.fileURL {\n             do {\n-                try NSFileManager.defaultManager().removeItemAtURL(fileURL)\n+                try FileManager.default.removeItem(at: fileURL)\n             } catch _ {\n             }\n         }\n-        error = NSError(domain: \"streamEventError\", code: 0, userInfo: nil)\n-        fileURL = nil\n-    }\n+        self.fileURL = nil\n+    } \n     \n-    override func streamEventHasBytes(aStream: NSStream) -> (Bool, NSError?) {\n-        var parsedBytes: Int = 0\n+    override func streamEventHasBytes(_ aStream: Stream) -> (Bool, NSError?) {\n+        guard let totalBytesSize = aStream.property(forKey: Stream.PropertyKey(rawValue: kCFStreamPropertyFTPResourceSize as String)) as? Int,\n+            let inputStream = aStream as? InputStream else {\n+                return (true, nil)\n+        }\n+        var downloadedBytes: Int = 0\n+        var parsetBytes: Int = 0","path":"rebekka-source/Rebekka/FileDownloadOperation.swift","position":67,"original_position":67,"commit_id":"cfadb9b08a50c2ace7775482cd7019ca33ce1cdf","original_commit_id":"cfadb9b08a50c2ace7775482cd7019ca33ce1cdf","user":{"login":"SimonStefan","id":1750661,"avatar_url":"https://avatars2.githubusercontent.com/u/1750661?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonStefan","html_url":"https://github.com/SimonStefan","followers_url":"https://api.github.com/users/SimonStefan/followers","following_url":"https://api.github.com/users/SimonStefan/following{/other_user}","gists_url":"https://api.github.com/users/SimonStefan/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonStefan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonStefan/subscriptions","organizations_url":"https://api.github.com/users/SimonStefan/orgs","repos_url":"https://api.github.com/users/SimonStefan/repos","events_url":"https://api.github.com/users/SimonStefan/events{/privacy}","received_events_url":"https://api.github.com/users/SimonStefan/received_events","type":"User","site_admin":false},"body":"typo: parsedBytes","created_at":"2018-02-07T16:18:43Z","updated_at":"2018-02-07T16:32:10Z","html_url":"https://github.com/BYTEPOETS/rebekka/pull/2#discussion_r166670072","pull_request_url":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/2","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/comments/166670072"},"html":{"href":"https://github.com/BYTEPOETS/rebekka/pull/2#discussion_r166670072"},"pull_request":{"href":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/2","id":167719652,"html_url":"https://github.com/BYTEPOETS/rebekka/pull/2","diff_url":"https://github.com/BYTEPOETS/rebekka/pull/2.diff","patch_url":"https://github.com/BYTEPOETS/rebekka/pull/2.patch","issue_url":"https://api.github.com/repos/BYTEPOETS/rebekka/issues/2","number":2,"state":"open","locked":false,"title":"Feature/update swift4","user":{"login":"EMart86","id":3198153,"avatar_url":"https://avatars1.githubusercontent.com/u/3198153?v=4","gravatar_id":"","url":"https://api.github.com/users/EMart86","html_url":"https://github.com/EMart86","followers_url":"https://api.github.com/users/EMart86/followers","following_url":"https://api.github.com/users/EMart86/following{/other_user}","gists_url":"https://api.github.com/users/EMart86/gists{/gist_id}","starred_url":"https://api.github.com/users/EMart86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EMart86/subscriptions","organizations_url":"https://api.github.com/users/EMart86/orgs","repos_url":"https://api.github.com/users/EMart86/repos","events_url":"https://api.github.com/users/EMart86/events{/privacy}","received_events_url":"https://api.github.com/users/EMart86/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-07T15:12:27Z","updated_at":"2018-02-07T16:32:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d21fc1b81117f3eeadc50875d5db20da96a6df2c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/2/commits","review_comments_url":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/2/comments","review_comment_url":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BYTEPOETS/rebekka/issues/2/comments","statuses_url":"https://api.github.com/repos/BYTEPOETS/rebekka/statuses/cfadb9b08a50c2ace7775482cd7019ca33ce1cdf","head":{"label":"BYTEPOETS:feature/update_swift4","ref":"feature/update_swift4","sha":"cfadb9b08a50c2ace7775482cd7019ca33ce1cdf","user":{"login":"BYTEPOETS","id":9657380,"avatar_url":"https://avatars3.githubusercontent.com/u/9657380?v=4","gravatar_id":"","url":"https://api.github.com/users/BYTEPOETS","html_url":"https://github.com/BYTEPOETS","followers_url":"https://api.github.com/users/BYTEPOETS/followers","following_url":"https://api.github.com/users/BYTEPOETS/following{/other_user}","gists_url":"https://api.github.com/users/BYTEPOETS/gists{/gist_id}","starred_url":"https://api.github.com/users/BYTEPOETS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BYTEPOETS/subscriptions","organizations_url":"https://api.github.com/users/BYTEPOETS/orgs","repos_url":"https://api.github.com/users/BYTEPOETS/repos","events_url":"https://api.github.com/users/BYTEPOETS/events{/privacy}","received_events_url":"https://api.github.com/users/BYTEPOETS/received_events","type":"Organization","site_admin":false},"repo":{"id":51071277,"name":"rebekka","full_name":"BYTEPOETS/rebekka","owner":{"login":"BYTEPOETS","id":9657380,"avatar_url":"https://avatars3.githubusercontent.com/u/9657380?v=4","gravatar_id":"","url":"https://api.github.com/users/BYTEPOETS","html_url":"https://github.com/BYTEPOETS","followers_url":"https://api.github.com/users/BYTEPOETS/followers","following_url":"https://api.github.com/users/BYTEPOETS/following{/other_user}","gists_url":"https://api.github.com/users/BYTEPOETS/gists{/gist_id}","starred_url":"https://api.github.com/users/BYTEPOETS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BYTEPOETS/subscriptions","organizations_url":"https://api.github.com/users/BYTEPOETS/orgs","repos_url":"https://api.github.com/users/BYTEPOETS/repos","events_url":"https://api.github.com/users/BYTEPOETS/events{/privacy}","received_events_url":"https://api.github.com/users/BYTEPOETS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BYTEPOETS/rebekka","description":"Rebekka - FTP/FTPS client in Swift.","fork":true,"url":"https://api.github.com/repos/BYTEPOETS/rebekka","forks_url":"https://api.github.com/repos/BYTEPOETS/rebekka/forks","keys_url":"https://api.github.com/repos/BYTEPOETS/rebekka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BYTEPOETS/rebekka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BYTEPOETS/rebekka/teams","hooks_url":"https://api.github.com/repos/BYTEPOETS/rebekka/hooks","issue_events_url":"https://api.github.com/repos/BYTEPOETS/rebekka/issues/events{/number}","events_url":"https://api.github.com/repos/BYTEPOETS/rebekka/events","assignees_url":"https://api.github.com/repos/BYTEPOETS/rebekka/assignees{/user}","branches_url":"https://api.github.com/repos/BYTEPOETS/rebekka/branches{/branch}","tags_url":"https://api.github.com/repos/BYTEPOETS/rebekka/tags","blobs_url":"https://api.github.com/repos/BYTEPOETS/rebekka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BYTEPOETS/rebekka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BYTEPOETS/rebekka/git/refs{/sha}","trees_url":"https://api.github.com/repos/BYTEPOETS/rebekka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BYTEPOETS/rebekka/statuses/{sha}","languages_url":"https://api.github.com/repos/BYTEPOETS/rebekka/languages","stargazers_url":"https://api.github.com/repos/BYTEPOETS/rebekka/stargazers","contributors_url":"https://api.github.com/repos/BYTEPOETS/rebekka/contributors","subscribers_url":"https://api.github.com/repos/BYTEPOETS/rebekka/subscribers","subscription_url":"https://api.github.com/repos/BYTEPOETS/rebekka/subscription","commits_url":"https://api.github.com/repos/BYTEPOETS/rebekka/commits{/sha}","git_commits_url":"https://api.github.com/repos/BYTEPOETS/rebekka/git/commits{/sha}","comments_url":"https://api.github.com/repos/BYTEPOETS/rebekka/comments{/number}","issue_comment_url":"https://api.github.com/repos/BYTEPOETS/rebekka/issues/comments{/number}","contents_url":"https://api.github.com/repos/BYTEPOETS/rebekka/contents/{+path}","compare_url":"https://api.github.com/repos/BYTEPOETS/rebekka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BYTEPOETS/rebekka/merges","archive_url":"https://api.github.com/repos/BYTEPOETS/rebekka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BYTEPOETS/rebekka/downloads","issues_url":"https://api.github.com/repos/BYTEPOETS/rebekka/issues{/number}","pulls_url":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls{/number}","milestones_url":"https://api.github.com/repos/BYTEPOETS/rebekka/milestones{/number}","notifications_url":"https://api.github.com/repos/BYTEPOETS/rebekka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BYTEPOETS/rebekka/labels{/name}","releases_url":"https://api.github.com/repos/BYTEPOETS/rebekka/releases{/id}","deployments_url":"https://api.github.com/repos/BYTEPOETS/rebekka/deployments","created_at":"2016-02-04T11:22:51Z","updated_at":"2016-02-04T11:22:52Z","pushed_at":"2018-02-07T15:12:28Z","git_url":"git://github.com/BYTEPOETS/rebekka.git","ssh_url":"git@github.com:BYTEPOETS/rebekka.git","clone_url":"https://github.com/BYTEPOETS/rebekka.git","svn_url":"https://github.com/BYTEPOETS/rebekka","homepage":"","size":76,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"BYTEPOETS:master","ref":"master","sha":"952e5ea79ed4db040133ebd340b5fb9b5e796c0e","user":{"login":"BYTEPOETS","id":9657380,"avatar_url":"https://avatars3.githubusercontent.com/u/9657380?v=4","gravatar_id":"","url":"https://api.github.com/users/BYTEPOETS","html_url":"https://github.com/BYTEPOETS","followers_url":"https://api.github.com/users/BYTEPOETS/followers","following_url":"https://api.github.com/users/BYTEPOETS/following{/other_user}","gists_url":"https://api.github.com/users/BYTEPOETS/gists{/gist_id}","starred_url":"https://api.github.com/users/BYTEPOETS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BYTEPOETS/subscriptions","organizations_url":"https://api.github.com/users/BYTEPOETS/orgs","repos_url":"https://api.github.com/users/BYTEPOETS/repos","events_url":"https://api.github.com/users/BYTEPOETS/events{/privacy}","received_events_url":"https://api.github.com/users/BYTEPOETS/received_events","type":"Organization","site_admin":false},"repo":{"id":51071277,"name":"rebekka","full_name":"BYTEPOETS/rebekka","owner":{"login":"BYTEPOETS","id":9657380,"avatar_url":"https://avatars3.githubusercontent.com/u/9657380?v=4","gravatar_id":"","url":"https://api.github.com/users/BYTEPOETS","html_url":"https://github.com/BYTEPOETS","followers_url":"https://api.github.com/users/BYTEPOETS/followers","following_url":"https://api.github.com/users/BYTEPOETS/following{/other_user}","gists_url":"https://api.github.com/users/BYTEPOETS/gists{/gist_id}","starred_url":"https://api.github.com/users/BYTEPOETS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BYTEPOETS/subscriptions","organizations_url":"https://api.github.com/users/BYTEPOETS/orgs","repos_url":"https://api.github.com/users/BYTEPOETS/repos","events_url":"https://api.github.com/users/BYTEPOETS/events{/privacy}","received_events_url":"https://api.github.com/users/BYTEPOETS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BYTEPOETS/rebekka","description":"Rebekka - FTP/FTPS client in Swift.","fork":true,"url":"https://api.github.com/repos/BYTEPOETS/rebekka","forks_url":"https://api.github.com/repos/BYTEPOETS/rebekka/forks","keys_url":"https://api.github.com/repos/BYTEPOETS/rebekka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BYTEPOETS/rebekka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BYTEPOETS/rebekka/teams","hooks_url":"https://api.github.com/repos/BYTEPOETS/rebekka/hooks","issue_events_url":"https://api.github.com/repos/BYTEPOETS/rebekka/issues/events{/number}","events_url":"https://api.github.com/repos/BYTEPOETS/rebekka/events","assignees_url":"https://api.github.com/repos/BYTEPOETS/rebekka/assignees{/user}","branches_url":"https://api.github.com/repos/BYTEPOETS/rebekka/branches{/branch}","tags_url":"https://api.github.com/repos/BYTEPOETS/rebekka/tags","blobs_url":"https://api.github.com/repos/BYTEPOETS/rebekka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BYTEPOETS/rebekka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BYTEPOETS/rebekka/git/refs{/sha}","trees_url":"https://api.github.com/repos/BYTEPOETS/rebekka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BYTEPOETS/rebekka/statuses/{sha}","languages_url":"https://api.github.com/repos/BYTEPOETS/rebekka/languages","stargazers_url":"https://api.github.com/repos/BYTEPOETS/rebekka/stargazers","contributors_url":"https://api.github.com/repos/BYTEPOETS/rebekka/contributors","subscribers_url":"https://api.github.com/repos/BYTEPOETS/rebekka/subscribers","subscription_url":"https://api.github.com/repos/BYTEPOETS/rebekka/subscription","commits_url":"https://api.github.com/repos/BYTEPOETS/rebekka/commits{/sha}","git_commits_url":"https://api.github.com/repos/BYTEPOETS/rebekka/git/commits{/sha}","comments_url":"https://api.github.com/repos/BYTEPOETS/rebekka/comments{/number}","issue_comment_url":"https://api.github.com/repos/BYTEPOETS/rebekka/issues/comments{/number}","contents_url":"https://api.github.com/repos/BYTEPOETS/rebekka/contents/{+path}","compare_url":"https://api.github.com/repos/BYTEPOETS/rebekka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BYTEPOETS/rebekka/merges","archive_url":"https://api.github.com/repos/BYTEPOETS/rebekka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BYTEPOETS/rebekka/downloads","issues_url":"https://api.github.com/repos/BYTEPOETS/rebekka/issues{/number}","pulls_url":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls{/number}","milestones_url":"https://api.github.com/repos/BYTEPOETS/rebekka/milestones{/number}","notifications_url":"https://api.github.com/repos/BYTEPOETS/rebekka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BYTEPOETS/rebekka/labels{/name}","releases_url":"https://api.github.com/repos/BYTEPOETS/rebekka/releases{/id}","deployments_url":"https://api.github.com/repos/BYTEPOETS/rebekka/deployments","created_at":"2016-02-04T11:22:51Z","updated_at":"2016-02-04T11:22:52Z","pushed_at":"2018-02-07T15:12:28Z","git_url":"git://github.com/BYTEPOETS/rebekka.git","ssh_url":"git@github.com:BYTEPOETS/rebekka.git","clone_url":"https://github.com/BYTEPOETS/rebekka.git","svn_url":"https://github.com/BYTEPOETS/rebekka","homepage":"","size":76,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/2"},"html":{"href":"https://github.com/BYTEPOETS/rebekka/pull/2"},"issue":{"href":"https://api.github.com/repos/BYTEPOETS/rebekka/issues/2"},"comments":{"href":"https://api.github.com/repos/BYTEPOETS/rebekka/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BYTEPOETS/rebekka/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/BYTEPOETS/rebekka/statuses/cfadb9b08a50c2ace7775482cd7019ca33ce1cdf"}},"author_association":"NONE"}}
{"actor":{"display_login":"SimonStefan"}}