ftp-client-0.5.1.4: 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

Instances
Eq FTPResponse Source # 
Instance details

Defined in Network.FTP.Client

Show FTPResponse Source # 
Instance details

Defined in Network.FTP.Client

data FTPMessage Source #

Instances
Eq FTPMessage Source # 
Instance details

Defined in Network.FTP.Client

Show FTPMessage Source # 
Instance details

Defined in Network.FTP.Client

data ResponseStatus Source #

First digit of an FTP response

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 

Exceptions

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.

recvAll :: (MonadIO m, MonadCatch m) => Handle -> m ByteString Source #

Recieve all data and return it as a ByteString

sendAll :: MonadIO m => Handle -> [FTPCommand] -> m [FTPResponse] Source #

Equvalent to

mapM . sendCommand

sendAllS :: MonadIO m => Handle -> [FTPCommand] -> m [FTPResponse] Source #

Equvalent to

mapM . sendCommandS

getLineResp :: Handle -> IO ByteString Source #

Get a line from the server

getResponse :: 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