ftp-client-0.5.1.1: 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 #

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 #

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) #

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

mkd :: MonadIO m => Handle -> String -> m String #

pwd :: MonadIO m => Handle -> m String #

Data Commands

nlst :: (MonadIO m, MonadMask m) => Handle -> [String] -> m ByteString #

list :: (MonadIO m, MonadMask m) => Handle -> [String] -> m ByteString #

stor :: (MonadIO m, MonadMask m) => Handle -> String -> ByteString -> RTypeCode -> m () #

Types

data FTPResponse #

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

Constructors

FTPResponse 

Fields

Instances
Show FTPResponse # 
Instance details

Defined in Network.FTP.Client

data ResponseStatus #

First digit of an FTP response

data MlsxResponse #

Constructors

MlsxResponse 
Instances
Show MlsxResponse # 
Instance details

Defined in Network.FTP.Client

data RTypeCode #

Constructors

TA 
TI 

data PortActivity #

Constructors

Active 
Passive 

data ProtType #

Constructors

P 
C 

data Security #

Constructors

Clear 
TLS 

data Handle #

Can send and recieve a ByteString.

Constructors

Handle 

Exceptions

Handle Implementations

Lower Level Functions

sendCommand :: MonadIO m => Handle -> FTPCommand -> m FTPResponse #

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

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

Equvalent to

mapM . sendCommand

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

Equvalent to

mapM . sendCommandS

getLineResp :: Handle -> IO ByteString #

Get a line from the server

getResponse :: MonadIO m => Handle -> m FTPResponse #

Get a full response from the server Used in sendCommand

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

Send setup commands to the server and create a data Handle

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

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