FTPClient.ConnContextType
ConnContext

Keeps track of a persistent FTP connection.

Arguments

  • url::AbstractString: url of the FTP server.
  • options::RequestOptions: the options used for the connection.

Keywords

  • verbose::Union{IOStream,Bool}=false: an IOStream to capture LibCURL's output or a Bool, if true output is written to STDERR.
FTPClient.FTPMethod
FTP(url; kwargs...)

Connect to an FTP server using the information specified in the URI.

Keywords

  • verify_peer::Bool=true: verify the authenticity of the peer's certificate.
  • active_mode::Bool=false: use active mode to establish data connection.

Example

julia> FTP("ftp://user:password@ftp.example.com");  # FTP connection with no security

julia> FTP("ftpes://user:password@ftp.example.com");  # Explicit security (FTPES)

julia> FTP("ftps://user:password@ftp.example.com");  # Implicit security (FTPS)
FTPClient.FTPMethod
FTP(; kwargs...) -> FTP

Create an FTP object.

Keywords

  • hostname::AbstractString="": the hostname or address of the FTP server.
  • username::AbstractString="": the username used to access the FTP server.
  • password::AbstractString="": the password used to access the FTP server.
  • ssl::Bool=false: use a secure FTP connection.
  • implicit::Bool=false: use implicit security (FTPS).
  • verify_peer::Bool=true: verify authenticity of peer's certificate.
  • active_mode::Bool=false: use active mode to establish data connection.
  • verbose::Union{Bool,IOStream}=false: an IOStream to capture LibCurl's output or a Bool, if true output is written to STDERR.
FTPClient.RequestOptionsMethod
RequestOptions(; kwargs...)

The options used to connect to an FTP server.

Keywords

  • hostname::AbstractString="localhost": the hostname or address of the FTP server.
  • username::AbstractString="": the username used to access the FTP server.
  • password::AbstractString="": the password used to access the FTP server.
  • implicit::Bool=false: use an implicit FTPS configuration.
  • ssl::Bool=false: use a secure connection. Typically specified for explicit FTPS.
  • verify_peer::Bool=true: verify authenticity of peer's certificate.
  • active_mode::Bool=false: use active mode to establish data connection.
FTPClient.ResponseType
Response

The response returned from a connection to an FTP server.

Parameters

  • body::IO: contains the result of a command from ftpcommand. or the content of a downloaded file from ftpget (if no destination file was defined).
  • headers::Array{AbstractString}: the header responses from the server.
  • code::UInt: the last header response code from the server.
  • total_time::Float64: the time the connection took.
  • bytes_recd::Int: the amount of bytes transmitted from the server (the file size in the case of ftp_get).
Base.closeMethod
close(ftp::FTP)

Close FTP connection.

Base.downloadFunction
download(
    ftp::FTP,
    file_name::AbstractString,
    save_path::AbstractString="";
    mode::FTP_MODE=binary_mode,
)

Download the file "filename" from FTP server and return IOStream. If "savepath" is not specified, contents are written to and returned as an IOBuffer.

FTPClient.ftpMethod
ftp(
    code::Function;
    hostname::AbstractString="", implicit::Bool=false, ssl::Bool=false,
    verify_peer::Bool=true, active_mode::Bool=false, username::AbstractString="",
    password::AbstractString="", verbose::Union{Bool,IOStream}=false,
)

Execute Function "code" on FTP server.

FTPClient.ftp_commandMethod
ftp_command(
    ctxt::ConnContext,
    cmd::AbstractString
)

Pass FTP command with persistent connection. Returns a Response.

FTPClient.ftp_commandMethod
ftp_command(
    options::RequestOptions,
    cmd::AbstractString;
    verbose::Union{Bool,IOStream}=false,
)

Pass FTP command with non-persistent connection. Returns a Response.

FTPClient.ftp_connectMethod
ftp_connect(options::RequestOptions; verbose::Union{Bool,IOStream}=false)

Establish connection to FTP server. Returns a ConnContext and a Response.

FTPClient.ftp_getFunction
ftp_get(
    options::RequestOptions,
    file_name::AbstractString,
    save_path::AbstractString="";
    mode::FTP_MODE=binary_mode,
    verbose::Union{Bool,IOStream}=false,
)

Download a file with a non-persistent connection. Returns a Response.

Arguments

  • options::RequestOptions: the connection options. See RequestOptions for details.
  • file_name::AbstractString: the path to the file on the server.
  • save_path::AbstractString="": if not specified the file is written to the Response body.
  • mode::FTP_MODE=binary_mode: defines whether the file is transferred in binary or ASCII format.
  • verbose::Union{Bool,IOStream}=false: an IOStream to capture LibCurl's output or a Bool, if true output is written to STDERR.
FTPClient.ftp_getFunction
ftp_get(
    ctxt::ConnContext,
    file_name::AbstractString,
    save_path::AbstractString="";
    mode::FTP_MODE=binary_mode,
)

Download a file with a persistent connection. Returns a Response.

Arguments

  • ctxt::ConnContext: encompasses the connection options defined via ftp_connect. See RequestOptions for details.
  • file_name::AbstractString: the path to the file on the server.
  • save_path::AbstractString="": if not specified the file is written to the Response body.
  • mode::FTP_MODE=binary_mode: defines whether the file is transferred in binary or ASCII format.
FTPClient.ftp_putMethod
ftp_put(
    ctxt::ConnContext,
    file_name::AbstractString,
    file::IO;
    mode::FTP_MODE=binary_mode,
)

Upload file with persistent connection. Returns a Response.

Arguments

  • ctxt::ConnContext: encompases the connection options defined via ftp_connect. See RequestOptions for details.
  • file_name::AbstractString: the path to the file on the server.
  • file::IO: what is being written to the server.
  • mode::FTP_MODE=binary_mode: defines whether the file is transferred in binary or ASCII format.
FTPClient.ftp_putMethod
ftp_put(
    options::RequestOptions,
    file_name::AbstractString,
    file::IO;
    mode::FTP_MODE=binary_mode,
    verbose::Union{Bool,IOStream}=false,
)

Upload file with non-persistent connection. Returns a Response.

Arguments

  • options::RequestOptions: the connection options. See RequestOptions for details.
  • file_name::AbstractString: the path to the file on the server.
  • file::IO: what is being written to the server.
  • mode::FTP_MODE=binary_mode: defines whether the file is transferred in binary or ASCII format.
  • verbose::Union{Bool,IOStream}=false: an IOStream to capture LibCurl's output or a Bool, if true output is written to STDERR.
FTPClient.rmdirMethod
rmdir(ftp::FTP, dir_name::AbstractString)

Delete directory "dir_name" from FTP server.

FTPClient.uploadMethod
upload(
    ftp::FTP,
    local_path::AbstractString,
    remote_path::AbstractString;
    ftp_options=ftp.ctxt,
    mode::FTP_MODE=binary_mode,
) -> Response

Uploads the file specified in "localpath" to the file or directory specifies in "remotepath".

If "remotepath" is a path to a file, then the file will be uploaded to the FTP using the provided path. If "remotepath" is a path to a directory (which means it ends in "/", ".", or ".."), then the file will be uploaded to the specified directory but with the "local_path" basename as the file name.

Arguments

  • ftp::FTP: The FTP to deliver to. See FTPClient.FTP for details.
  • local_path::AbstractString: The file path to the file we want to deliver.
  • remote_path::AbstractString: The file/dir path that we want to deliver to.

Keywords

  • ftp_options=ftp.ctxt: FTP Options
  • mode::FTP_MODE=binary_mode: Set the ftp mode.

Returns

FTPResponse: Returns the ftp response object

FTPClient.uploadMethod
upload(
    ftp::FTP,
    local_path_io::IO,
    remote_path::AbstractString;
    ftp_options=ftp.ctxt,
    mode::FTP_MODE=binary_mode,

) -> Response

Upload IO object "localpathio" to the FTP server and save as "remote_path".

Arguments

  • ftp::FTP: The FTP to deliver to. See FTPClient.FTP for details.
  • local_path_io::IO: The IO object that we want to deliver.
  • remote_path::AbstractString: The path that we want to deliver to.

Keywords

  • ftp_options=ftp.ctxt: FTP Options
  • mode::FTP_MODE=binary_mode: Set the ftp mode.

Returns

FTPResponse: Returns the ftp response object

Base.Filesystem.cdMethod
cd(ftp::FTP, dir::AbstractString)

Set the current working directory of the FTP server to "dir".

Base.Filesystem.mvMethod
mv(
    ftp::FTP,
    file_name::AbstractString,
    new_name::AbstractString;
)

Move (rename) file "filename" to "newname" on FTP server.

Base.Filesystem.readdirMethod
readdir(ftp::FTP)

Return the contents of the current working directory of the FTP server.

Base.Filesystem.rmMethod
rm(ftp::FTP, file_name::AbstractString)

Delete file "file_name" from FTP server.