Client: Client
Represents an FTP client that intracts with an FTP server
Constructor
Gets invoked during object initialization.
init (ClientConfiguration clientConfig)
- clientConfig ClientConfiguration
Configurations for FTP client
Remote Methods
get | Retrieves the file content from a remote resource. |
append | Appends the content to an existing file in an FTP server. |
put | Adds a file to an FTP server. |
mkdir | Creates a new directory in an FTP server. |
rmdir | Deletes an empty directory in an FTP server. |
rename | Renames a file or moves it to a new location within the same FTP server. |
size | Gets the size of a file resource. |
list | Gets the file name list in a given folder. |
isDirectory | Checks if a given resource is a directory. |
delete | Deletes a file from an FTP server. |
get
Retrieves the file content from a remote resource.
1stream<byte[] & readonly, io:Error?>|ftp:Error channel = client->get(path);
Parameters
- path string
The resource path
append
function append(string path, stream<byte[ ] & readonly, Error?> | string | xml | json content) returns Error?
Appends the content to an existing file in an FTP server.
1ftp:Error? response = client->append(path, channel);
Parameters
- path string
The resource path
Return Type
(Error?)()
or else an ftp:Error
if failed to establish
the communication with the FTP server
put
function put(string path, stream<byte[ ] & readonly, Error?> | string | xml | json content, Compression compressionType) returns Error?
Adds a file to an FTP server.
1ftp:Error? response = client->put(path, channel);
Parameters
- path string
The resource path
- compressionType Compression (default NONE)
Type of the compression to be used, if the file should be compressed before uploading
Return Type
(Error?)()
or else an ftp:Error
if failed to establish
the communication with the FTP server
rename
Renames a file or moves it to a new location within the same FTP server.
1ftp:Error? response = client->rename(origin, destination);
Return Type
(Error?)()
or else an ftp:Error
if failed to establish
the communication with the FTP server
size
Gets the size of a file resource.
1int|ftp:Error response = client->size(path);
Parameters
- path string
The resource path
list
Gets the file name list in a given folder.
1ftp:FileInfo[]|ftp:Error response = client->list(path);
Parameters
- path string
The directory path
isDirectory
Checks if a given resource is a directory.
1boolean|ftp:Error response = client->isDirectory(path);
Parameters
- path string
The resource path