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

LicensePublic Domain
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Network.FTP.Client

Contents

Description

 

Synopsis

Main Entrypoints

withFTP :: (MonadIO m, MonadMask m) => String -> Int -> (Handle -> FTPResponse -> m a) -> m 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 :: (MonadMask m, MonadIO m) => String -> Int -> (Handle -> FTPResponse -> m a) -> m 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.

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

Control Commands

pasv :: MonadIO m => Handle -> m (String, Int) Source #

size :: MonadIO m => Handle -> String -> m Int Source #

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 ProtType Source #

Constructors

P 
C 

data Security Source #

Constructors

Clear 
TLS 

data Handle Source #

Can send and recieve a ByteString.

Constructors

Handle 

Handle Implementations

Lower Level Functions

sendCommand :: MonadIO m => Handle -> FTPCommand -> m 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 :: MonadIO m => Handle -> [FTPCommand] -> m [FTPResponse] Source #

Equvalent to

mapM . sendCommand

getLineResp :: Handle -> IO ByteString Source #

Get a line from the server

getMultiLineResp :: MonadIO m => Handle -> m FTPResponse Source #

Get a full response from the server Used in sendCommand

createSendDataCommand :: (MonadIO m, MonadMask m) => Handle -> PortActivity -> [FTPCommand] -> m Handle Source #

Send setup commands to the server and create a data Handle

createTLSSendDataCommand :: (MonadIO m, MonadMask m) => Handle -> PortActivity -> [FTPCommand] -> m Connection Source #

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