FTPClient.ConnContext
— TypeConnContext
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
: anIOStream
to capture LibCURL's output or aBool
, if true output is written to STDERR.
FTPClient.FTP
— MethodFTP(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.FTP
— MethodFTP(; 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
: anIOStream
to capture LibCurl's output or aBool
, if true output is written to STDERR.
FTPClient.RequestOptions
— MethodRequestOptions(; 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.Response
— TypeResponse
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.close
— Methodclose(ftp::FTP)
Close FTP connection.
Base.download
— Functiondownload(
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.ftp
— Methodftp(
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_cleanup
— Methodftp_cleanup()
Cleanup global libcurl.
FTPClient.ftp_close_connection
— Methodftp_close_connection(ctxt::ConnContext)
Close the connection to the FTP server.
FTPClient.ftp_command
— Methodftp_command(
ctxt::ConnContext,
cmd::AbstractString
)
Pass FTP command with persistent connection. Returns a Response
.
FTPClient.ftp_command
— Methodftp_command(
options::RequestOptions,
cmd::AbstractString;
verbose::Union{Bool,IOStream}=false,
)
Pass FTP command with non-persistent connection. Returns a Response
.
FTPClient.ftp_connect
— Methodftp_connect(options::RequestOptions; verbose::Union{Bool,IOStream}=false)
Establish connection to FTP server. Returns a ConnContext
and a Response
.
FTPClient.ftp_get
— Functionftp_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. SeeRequestOptions
for details.file_name::AbstractString
: the path to the file on the server.save_path::AbstractString=""
: if not specified the file is written to theResponse
body.mode::FTP_MODE=binary_mode
: defines whether the file is transferred in binary or ASCII format.verbose::Union{Bool,IOStream}=false
: anIOStream
to capture LibCurl's output or aBool
, if true output is written to STDERR.
FTPClient.ftp_get
— Functionftp_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. SeeRequestOptions
for details.file_name::AbstractString
: the path to the file on the server.save_path::AbstractString=""
: if not specified the file is written to theResponse
body.mode::FTP_MODE=binary_mode
: defines whether the file is transferred in binary or ASCII format.
FTPClient.ftp_init
— Methodftp_init()
Initialise global libcurl
FTPClient.ftp_put
— Methodftp_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. SeeRequestOptions
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_put
— Methodftp_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. SeeRequestOptions
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
: anIOStream
to capture LibCurl's output or aBool
, if true output is written to STDERR.
FTPClient.rmdir
— Methodrmdir(ftp::FTP, dir_name::AbstractString)
Delete directory "dir_name" from FTP server.
FTPClient.upload
— Methodupload(
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 Optionsmode::FTP_MODE=binary_mode
: Set the ftp mode.
Returns
FTPResponse
: Returns the ftp response object
FTPClient.upload
— Methodupload(
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 Optionsmode::FTP_MODE=binary_mode
: Set the ftp mode.
Returns
FTPResponse
: Returns the ftp response object
Base.Filesystem.cd
— Methodcd(ftp::FTP, dir::AbstractString)
Set the current working directory of the FTP server to "dir".
Base.Filesystem.mkdir
— Methodmkdir(ftp::FTP, dir::AbstractString)
Make directory "dir" on FTP server.
Base.Filesystem.mv
— Methodmv(
ftp::FTP,
file_name::AbstractString,
new_name::AbstractString;
)
Move (rename) file "filename" to "newname" on FTP server.
Base.Filesystem.pwd
— Methodpwd(ftp::FTP)
Get the current working directory of the FTP server
Base.Filesystem.readdir
— Methodreaddir(ftp::FTP)
Return the contents of the current working directory of the FTP server.
Base.Filesystem.rm
— Methodrm(ftp::FTP, file_name::AbstractString)
Delete file "file_name" from FTP server.