ftp-client-0.2.0.0: Transfer files with FTP and FTPS

LicensePublic Domain
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Network.FTP.Client

Contents

Description

 

Synopsis

Main Entrypoints

withFTP :: String -> Int -> (Handle -> FTPResponse -> IO a) -> IO a Source #

Takes a host name and port. A handle for interacting with the server will be returned in a callback.

     withFTP "ftp.server.com" 21 $ h welcome -> do
         print welcome
         login h "username" "password"
         print =<< nlst h []

withFTPS :: String -> Int -> (Handle -> FTPResponse -> IO a) -> IO a Source #

Takes a host name and port. A handle for interacting with the server will be returned in a callback. The commands will be protected with TLS. Make sure to use TLS data commands like nlstS or retrS if you want those to use TLS as well

     withFTPS "ftps.server.com" 21 $ h welcome -> do
         print welcome
         login h "username" "password"
         print =<< nlstS h []

Control Commands

Data Commands

Secure Data Commands

Types

data FTPResponse Source #

Response from an FTP command. ex "200 Welcome!"

Constructors

FTPResponse 

Fields

data RTypeCode Source #

Constructors

TA 
TI 

data PortActivity Source #

Constructors

Active 
Passive 

data Handle Source #

Can send and recieve a ByteString.

Constructors

Handle 

Fields

Handle Implementations

Lower Level Functions

sendCommand :: Handle -> FTPCommand -> IO FTPResponse Source #

Send a command to the server and get a response back. Some commands use a data Handle, and their data is not returned here.

sendCommands :: Handle -> [FTPCommand] -> IO [FTPResponse] Source #

Equvalent to

mapM . sendCommand

getLineResp :: Handle -> IO ByteString Source #

Get a line from the server

getMultiLineResp :: Handle -> IO FTPResponse Source #

Get a full response from the server Used in sendCommand

createSendDataCommand :: Handle -> PortActivity -> [FTPCommand] -> IO Handle Source #

Send setup commands to the server and create a data Handle

createTLSSendDataCommand :: Handle -> PortActivity -> [FTPCommand] -> IO Connection Source #

Send setup commands to the server and create a data TLS connection