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
CkScpobject.
Properties
- abortCurrent ↔ bool
-
Set to
trueto 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
AbortCheckevent 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:
truemeans success,falsemeans 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
trueto 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
trueto 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
PercentDoneevent callbacks. The default is100, which reports progress in whole-percent units. For example, when the scale is1000, a callback value of453represents 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
0644to 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 isfalse. 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
remotePathand appends its exact bytes to the existing contents of theBinDataobject inbd. -
downloadBinaryEncoded(
String remotePath, String encoding) → String -
Downloads the file at
remotePathand returns its bytes encoded as text using the binary encoding named byencoding, such asbase64orhex. -
downloadFile(
String remotePath, String localPath) → void -
Downloads the file at
remotePathfrom the SSH server and writes its bytes to the local filesystem path inlocalPath. -
downloadString(
String remotePath, String charset) → String -
Downloads the file at
remotePath, decodes its bytes using the character encoding named bycharset, 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
remoteRootto the local directory rooted atlocalRoot.bRecursecontrols recursion: set it totrueto descend into subdirectories, orfalseto 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
localBaseDirto the remote directory rooted atremoteBaseDir.bRecursecontrols recursion: set it totrueto descend into subdirectories, orfalseto 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
BinDataobject inbdto the remote file atremotePath. The data is transferred without character decoding or other transformation. -
uploadBinaryEncoded(
String remotePath, String encodedData, String encoding) → void -
Decodes the text in
encodedDatausing the binary encoding named byencoding, then uploads the resulting bytes to the remote file atremotePath. Typical encoding names includebase64andhex. -
uploadFile(
String localPath, String remotePath) → void -
Uploads the local filesystem file at
localPathto the remote path inremotePath. The file is transferred as raw bytes. -
uploadString(
String remotePath, String textData, String charset) → void -
Encodes the text in
textDatausing the character encoding named bycharset, then uploads the resulting bytes to the remote file atremotePath. -
useSsh(
CkSsh sshConnection) → void -
Associates this
Scpobject with the connected and authenticatedSshobject insshConnection. Subsequent SCP operations use that existing SSH session rather than opening a separate network connection.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited