Skip to content

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.

ConstructorProtocol / ServiceTypical use case
new SftpClient()SFTP (SSH file transfer, port 22)Connecting to any SFTP/SSH server
new FtpsClient()Plain FTP, explicit FTPS, implicit FTPSAny FTP or FTPS server
new S3Client()Amazon S3 and S3-compatible servicesAWS S3, MinIO, Wasabi, Backblaze B2, etc.
new AzureClient()Azure Blob StorageMicrosoft Azure or the Azurite local emulator
new GCSClient()Google Cloud StorageGCS buckets

Common usage pattern

Every client follows an identical three-step lifecycle regardless of the underlying protocol:

ts
// 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.

ConstantValueMeaning
NeverOverwrite0Skip the file if the destination already exists (default)
AlwaysOverwrite1Always replace the destination file
OverwriteIfDiffSize2Overwrite only when source and destination sizes differ
OverwriteIfNewer3Overwrite 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.

ConstantValueAlgorithm
OTFEAlgoAES256GCM0AES-256-GCM, PBKDF2-SHA256 key derivation (default)
OTFEAlgoOpenPGP1OpenPGP 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.

ConstantValueDescription
TLS_MODE_NONE0Plain FTP: no TLS encryption
TLS_MODE_EXPLICIT1Explicit FTPS: starts as plain FTP, upgrades via AUTH TLS (default)
TLS_MODE_IMPLICIT2Implicit FTPS: TLS from the first byte, typically port 990

FTP transfer mode constants

Passed to cli.SetMode() after connecting.

ConstantValueDescription
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