Skip to content

juanLovera/SwiftyFTP

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftyFTP

Linux macOS

Simple Linux version of "Rebekka - an FTP/FTPS client in Swift. Utilizes CFFTPStream API from CFNetworking."

Implemented FTP commands

  • Directory content listing.
  • Directory creation.
  • File upload/download.

Installation

Include the following to your Package.swift file:

.package(url: "https://github.com/juanLovera/SwiftyFTP.git", from: "1.0.0")

Usage

var configuration = SessionConfiguration()
configuration.host = "ftp://ftp.mozilla.org:21"
configuration.encoding = NSUTF8StringEncoding
_session = Session(configuration: configuration)
_session.list("/") {
    (resources, error) -> Void in
    println("List directory with result:\n\(resources), error: \(error)\n\n")
}
var configuration = SessionConfiguration()
configuration.host = "127.0.0.1"
_session = Session(configuration: configuration)
_session.download("/Users/foo/testdownload.png") {
   (fileURL, error) -> Void in
   println("Download file with result:\n\(fileURL), error: \(error)\n\n")
}
var configuration = SessionConfiguration()
configuration.host = "localhost:21"
configuration.username = "optimus"
configuration.password = "rollout"
if let URL = NSBundle.mainBundle().URLForResource("testUpload", withExtension: "png") {
   let path = "/Users/foo/bar/testUpload.png"
   _session.upload(URL, path: path) {
       (result, error) -> Void in
       println("Upload file with result:\n\(result), error: \(error)\n\n")
  }
}

Requirements

macOS & Linux: Swift 4.0.3 or Swift 4.1

###License

rebekka is licences under the BSD 2-Clause License (See License.txt for details.).

This library is licenced under MIT (see LICENSE file for details).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 100.0%