Client: Client

Isolated

Represents an FTP client that intracts with an FTP server

Constructor

Gets invoked during object initialization.

init (ClientConfiguration clientConfig)

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 direcotry 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 direcotry.

delete

Deletes a file from an FTP server.

get

function get(string path, int arraySize) returns stream<byte[ ] & readonly, Error?> | Error
Isolated Function
Remote Function

Retrieves the file content from a remote resource.

1stream<byte[] & readonly, io:Error?>|ftp:Error channel
2 = client->get(path);

Parameters

  • arraySize int (default 8192)
  • A defaultable paramerter to state the size of the byte array. Default size is 8KB

Return Type

(stream<byte[ ] & readonly, Error?> | Error)

A byte stream from which the file can be read or ftp:Error in case of errors

append

function append(string path, stream<byte[ ] & readonly, Error?> | string | xml | json content) returns Error?
Isolated Function
Remote Function

Appends the content to an existing file in an FTP server.

1ftp:Error? response = client->append(path, channel);

Parameters

  • content stream<byte[ ] & readonly, Error?> | string | xml | json
  • Content to be written to the file in server

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, boolean compressInput) returns Error?
Isolated Function
Remote Function

Adds a file to an FTP server.

1ftp:Error? response = client->put(path, channel);

Parameters

  • content stream<byte[ ] & readonly, Error?> | string | xml | json
  • Content to be written to the file in server

  • compressInput boolean (default false)
  • True if file should be compressed before uploading

Return Type

(Error?)

() or else an ftp:Error if failed to establish the communication with the FTP server

mkdir

function mkdir(string path) returns Error?
Isolated Function
Remote Function

Creates a new direcotry in an FTP server.

1ftp:Error? response = client->mkdir(path);

Parameters

  • path string
  • The directory path

Return Type

(Error?)

() or else an ftp:Error if failed to establish the communication with the FTP server

rmdir

function rmdir(string path) returns Error?
Isolated Function
Remote Function

Deletes an empty directory in an FTP server.

1ftp:Error? response = client->rmdir(path);

Parameters

  • path string
  • The directory path

Return Type

(Error?)

() or else an ftp:Error if failed to establish the communication with the FTP server

rename

function rename(string origin, string destination) returns Error?
Isolated Function
Remote Function

Renames a file or moves it to a new location within the same FTP server.

1ftp:Error? response = client->rename(origin, destination);

Parameters

  • origin string
  • The source file location

  • destination string
  • The destination file location

Return Type

(Error?)

() or else an ftp:Error if failed to establish the communication with the FTP server

size

function size(string path) returns int | Error
Isolated Function
Remote Function

Gets the size of a file resource.

1int|ftp:Error response = client->size(path);

Parameters

Return Type

(int | Error)

The file size in bytes or an ftp:Error if failed to establish the communication with the FTP server

list

function list(string path) returns FileInfo[ ] | Error
Isolated Function
Remote Function

Gets the file name list in a given folder.

1ftp:FileInfo[]|ftp:Error response = client->list(path);

Parameters

  • path string
  • The direcotry path

Return Type

(FileInfo[ ] | Error)

An array of file names or an ftp:Error if failed to establish the communication with the FTP server

isDirectory

function isDirectory(string path) returns boolean | Error
Isolated Function
Remote Function

Checks if a given resource is a direcotry.

1boolean|ftp:Error response = client->isDirectory(path);

Parameters

Return Type

(boolean | Error)

true if given resource is a direcotry or an ftp:Error if failed to establish the communication with the FTP server

delete

function delete(string path) returns Error?
Isolated Function
Remote Function

Deletes a file from an FTP server.

1ftp:Error? response = client->delete(path);

Parameters

Return Type

(Error?)

() or else an ftp:Error if failed to establish the communication with the FTP server