CkScp class final

Transfer files, text, and binary data over SCP using an existing SSH connection.

CkScp is the Chilkat class for SCP file transfer over an already-established Chilkat.Ssh connection. It supports local-file upload and download, in-memory binary transfer, encoded binary transfer, text transfer with explicit character sets, BinData transfer, directory-tree synchronization, sync filtering, remote UNIX permission overrides, environment variables, progress scaling, abort support, and asynchronous task integration.

Uses an SSH connection

Attach Scp to an authenticated Chilkat.Ssh session rather than opening a separate network connection.

Upload and download files

Transfer local files to remote paths or download remote files to the local filesystem using SCP.

Memory-based transfers

Upload or download binary data, encoded data, text, or Chilkat.BinData without requiring temporary files.

Directory synchronization

Synchronize directory trees and use filtering options to include or exclude selected files.

Remote file options

Set remote UNIX permissions, pass environment variables, and control transfer-related behavior required by the remote server.

Progress and async support

Monitor progress, scale progress percentages, abort active transfers, and run supported operations as asynchronous tasks.

Common pattern: Connect and authenticate with Chilkat.Ssh, initialize CkScp with that SSH connection, then upload, download, or synchronize the desired files or in-memory data. Use Scp for SCP-style transfers over SSH; use Chilkat.SFtp when the remote server expects the SFTP protocol instead.

For an extended overview, see Scp Class Overview.

A CkScp owns a native Chilkat object. It is released automatically when the Dart object is garbage collected, or immediately by dispose. Use it only from the isolate that created it.

Implemented types

Constructors

CkScp()
Creates a new CkScp object.

Properties

abortCurrent ↔ bool
Set to true to request cancellation of the method currently executing on this object. Long-running network and file-transfer operations check this property periodically; a method that completes quickly may finish before the request is observed.
getter/setter pair
debugLogFilePath ↔ String
If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. This logging helps identify the context and history of Chilkat calls leading up to any crash or hang, aiding in debugging.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
heartbeatMs ↔ int
Specifies the interval, in milliseconds, between AbortCheck event callbacks during supported long-running operations. The callback allows the application to report activity or request cancellation before the operation completes.
getter/setter pair
isDisposed → bool
Whether dispose has been called on this object.
no setter
lastErrorHtml → String
Provides HTML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
no setter
lastErrorText → String
Provides plain text information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
no setter
lastErrorXml → String
Provides XML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
no setter
lastMethodSuccess ↔ bool
Indicates the success or failure of the most recent method call: true means success, false means failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages. Note: This property does not apply to methods that return integer values or to boolean-returning methods where the boolean does not indicate success or failure.
getter/setter pair
onAbortCheck ↔ bool Function()?
Called periodically while a method of this object runs; return true to abort the method (it then fails with a ChilkatException).
getter/setter pair
onPercentDone ↔ bool Function(int pctDone)?
Called with the percentage completed (0-100) of the running method, when the method can measure its progress; return true to abort the method. See onAbortCheck.
getter/setter pair
onProgressInfo ↔ void Function(String name, String value)?
Called with a name/value pair describing the progress of the running method. See onAbortCheck.
getter/setter pair
percentDoneScale ↔ int
Specifies the value that represents 100% completion in PercentDone event callbacks. The default is 100, which reports progress in whole-percent units. For example, when the scale is 1000, a callback value of 453 represents 45.3% completion.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sendEnv ↔ String
Specifies environment variables to send for each SCP upload or download. Set the property to a JSON object whose member names are environment-variable names and whose values are strings.
getter/setter pair
syncedFiles ↔ String
Contains the local paths of the files transferred by the most recent call to syncTreeUpload or syncTreeDownload. Paths are listed one per line.
getter/setter pair
syncMustMatch ↔ String
Specifies a semicolon-separated list of wildcard patterns for filenames that are eligible for transfer by syncTreeUpload and syncTreeDownload. A file is considered only when its filename matches at least one pattern.
getter/setter pair
syncMustMatchDir ↔ String
Specifies a semicolon-separated list of wildcard patterns for directory names that may be traversed by syncTreeUpload and syncTreeDownload. When this property is nonempty, synchronization descends only into directories whose names match at least one pattern.
getter/setter pair
syncMustNotMatch ↔ String
Specifies a semicolon-separated list of wildcard patterns for filenames that must be skipped by syncTreeUpload and syncTreeDownload.
getter/setter pair
syncMustNotMatchDir ↔ String
Specifies a semicolon-separated list of wildcard patterns for directory names that must not be traversed by syncTreeUpload and syncTreeDownload. A matching directory and everything below it are skipped.
getter/setter pair
uncommonOptions ↔ String
Provides a comma-separated list of specialized compatibility options. The default is the empty string, which is appropriate for normal SCP transfers.
getter/setter pair
unixPermOverride ↔ String
Specifies an octal UNIX permission mode to apply to files uploaded by SCP, overriding the permissions derived from the local source file. For example, set this property to 0644 to grant read/write permission to the owner and read-only permission to the group and others.
getter/setter pair
verboseLogging ↔ bool
If set to true, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is false. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.
getter/setter pair
version → String
Version of the component/library, such as "10.1.0"
no setter

Methods

dispose() → void
Releases the native object now instead of waiting for garbage collection.
downloadBd(String remotePath, CkBinData bd) → void
Downloads the file at remotePath and appends its exact bytes to the existing contents of the BinData object in bd.
downloadBinaryEncoded(String remotePath, String encoding) → String
Downloads the file at remotePath and returns its bytes encoded as text using the binary encoding named by encoding, such as base64 or hex.
downloadFile(String remotePath, String localPath) → void
Downloads the file at remotePath from the SSH server and writes its bytes to the local filesystem path in localPath.
downloadString(String remotePath, String charset) → String
Downloads the file at remotePath, decodes its bytes using the character encoding named by charset, and returns the resulting text.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
syncTreeDownload(String remoteRoot, String localRoot, int mode, bool bRecurse) → void
Synchronizes files from the remote directory tree rooted at remoteRoot to the local directory rooted at localRoot. bRecurse controls recursion: set it to true to descend into subdirectories, or false to process only files directly in the root directory.
syncTreeUpload(String localBaseDir, String remoteBaseDir, int mode, bool bRecurse) → void
Synchronizes files from the local directory tree rooted at localBaseDir to the remote directory rooted at remoteBaseDir. bRecurse controls recursion: set it to true to descend into subdirectories, or false to process only files directly in the local base directory.
toString() → String
A string representation of this object.
override
uploadBd(String remotePath, CkBinData bd) → void
Uploads all bytes currently contained in the BinData object in bd to the remote file at remotePath. The data is transferred without character decoding or other transformation.
uploadBinaryEncoded(String remotePath, String encodedData, String encoding) → void
Decodes the text in encodedData using the binary encoding named by encoding, then uploads the resulting bytes to the remote file at remotePath. Typical encoding names include base64 and hex.
uploadFile(String localPath, String remotePath) → void
Uploads the local filesystem file at localPath to the remote path in remotePath. The file is transferred as raw bytes.
uploadString(String remotePath, String textData, String charset) → void
Encodes the text in textData using the character encoding named by charset, then uploads the resulting bytes to the remote file at remotePath.
useSsh(CkSsh sshConnection) → void
Associates this Scp object with the connected and authenticated Ssh object in sshConnection. Subsequent SCP operations use that existing SSH session rather than opening a separate network connection.

Operators

operator ==(Object other) → bool
The equality operator.
inherited