License | Public Domain |
---|---|
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
- withFTP :: (MonadIO m, MonadMask m) => String -> Int -> (Handle -> FTPResponse -> m a) -> m a
- withFTPS :: (MonadMask m, MonadIO m) => String -> Int -> (Handle -> FTPResponse -> m a) -> m a
- login :: MonadIO m => Handle -> String -> String -> m FTPResponse
- pasv :: MonadIO m => Handle -> m (String, Int)
- rename :: MonadIO m => Handle -> String -> String -> m FTPResponse
- dele :: MonadIO m => Handle -> String -> m FTPResponse
- cwd :: MonadIO m => Handle -> String -> m FTPResponse
- size :: MonadIO m => Handle -> String -> m Int
- mkd :: MonadIO m => Handle -> String -> m String
- rmd :: MonadIO m => Handle -> String -> m FTPResponse
- pwd :: MonadIO m => Handle -> m String
- quit :: MonadIO m => Handle -> m FTPResponse
- nlst :: (MonadIO m, MonadMask m) => Handle -> [String] -> m ByteString
- retr :: (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 ()
- data FTPCommand
- data FTPResponse = FTPResponse {}
- data ResponseStatus
- = Wait
- | Success
- | Continue
- | FailureRetry
- | Failure
- data RTypeCode
- data PortActivity
- data ProtType
- data Security
- data Handle = Handle {
- send :: ByteString -> IO ()
- sendLine :: ByteString -> IO ()
- recv :: Int -> IO ByteString
- recvLine :: IO ByteString
- security :: Security
- sIOHandleImpl :: Handle -> Handle
- tlsHandleImpl :: Connection -> Handle
- sendCommand :: MonadIO m => Handle -> FTPCommand -> m FTPResponse
- sendCommands :: MonadIO m => Handle -> [FTPCommand] -> m [FTPResponse]
- getLineResp :: Handle -> IO ByteString
- getMultiLineResp :: MonadIO m => Handle -> m FTPResponse
- sendCommandLine :: MonadIO m => Handle -> ByteString -> m ()
- createSendDataCommand :: (MonadIO m, MonadMask m) => Handle -> PortActivity -> [FTPCommand] -> m Handle
- createTLSSendDataCommand :: (MonadIO m, MonadMask m) => Handle -> PortActivity -> [FTPCommand] -> m Connection
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
Data Commands
Types
data FTPCommand Source #
Commands according to the FTP specification
data FTPResponse Source #
Response from an FTP command. ex "200 Welcome!"
FTPResponse | |
|
data ResponseStatus Source #
First digit of an FTP response
data PortActivity Source #
Can send and recieve a ByteString
.
Handle | |
|
Handle Implementations
sIOHandleImpl :: Handle -> Handle Source #
tlsHandleImpl :: Connection -> Handle Source #
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
sendCommandLine :: MonadIO m => Handle -> ByteString -> m () Source #
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