Remote client objects
SyncJS provides five remote-client objects for transferring files to and from remote systems over standard protocols and cloud storage services. All five objects implement an identical interface. Once you know how to use one, you know how to use all of them. Only the constructor and the connection fields differ.
IMPORTANT
Remote client objects (SftpClient, FtpsClient, S3Client, AzureClient, GCSClient) are available as of Syncplify Server! v7.0.16. Users running an older version do not have access to these features.
| Constructor | Protocol / Service | Typical use case |
|---|---|---|
new SftpClient() | SFTP (SSH file transfer, port 22) | Connecting to any SFTP/SSH server |
new FtpsClient() | Plain FTP, explicit FTPS, implicit FTPS | Any FTP or FTPS server |
new S3Client() | Amazon S3 and S3-compatible services | AWS S3, MinIO, Wasabi, Backblaze B2, etc. |
new AzureClient() | Azure Blob Storage | Microsoft Azure or the Azurite local emulator |
new GCSClient() | Google Cloud Storage | GCS buckets |
Common usage pattern
Every client follows an identical three-step lifecycle regardless of the underlying protocol:
// 1. Create the client and set connection parameters
var cli = new SftpClient();
cli.Host = "sftp.example.com:22";
cli.User = "alice";
cli.Pass = GetSecret("sftp-pass");
cli.HostKeySHA256 = "SHA256:AAAA...";
// 2. Connect, do work, then close
if (cli.Connect()) {
cli.Upload("/local/outbox/*.csv", "/remote/inbox");
cli.Close();
}Swap new SftpClient() and its connection fields for any other constructor and the rest of the code stays the same. See Client constructors and connection fields for the per-protocol parameters, and the Operations reference for the full list of methods.
Transfer-policy constants
The following global constants control the overwrite behaviour during uploads and downloads. They are set via cli.Options.UploadPolicy and cli.Options.DownloadPolicy.
| Constant | Value | Meaning |
|---|---|---|
NeverOverwrite | 0 | Skip the file if the destination already exists (default) |
AlwaysOverwrite | 1 | Always replace the destination file |
OverwriteIfDiffSize | 2 | Overwrite only when source and destination sizes differ |
OverwriteIfNewer | 3 | Overwrite only when the source is newer than the destination |
OTFE algorithm constants
On-the-Fly Encryption (OTFE) algorithm constants are set via cli.Options.OTFEAlgorithm. See ClientOptions for a full explanation of OTFE.
| Constant | Value | Algorithm |
|---|---|---|
OTFEAlgoAES256GCM | 0 | AES-256-GCM, PBKDF2-SHA256 key derivation (default) |
OTFEAlgoOpenPGP | 1 | OpenPGP symmetric passphrase encryption (RFC 4880) |
FtpsClient-specific constants
The following constants apply only to FtpsClient. See Client constructors and connection fields for usage.
TLS mode constants
Set via cli.TLSMode.
| Constant | Value | Description |
|---|---|---|
TLS_MODE_NONE | 0 | Plain FTP: no TLS encryption |
TLS_MODE_EXPLICIT | 1 | Explicit FTPS: starts as plain FTP, upgrades via AUTH TLS (default) |
TLS_MODE_IMPLICIT | 2 | Implicit FTPS: TLS from the first byte, typically port 990 |
FTP transfer mode constants
Passed to cli.SetMode() after connecting.
| Constant | Value | Description |
|---|---|---|
FTP_MODE_I | "I" | Binary/image mode: used for all file transfers (default) |
FTP_MODE_A | "A" | ASCII mode: line-ending translation; use only for plain text |
