Table of Contents

Interface IFileClient

Namespace
OpenShell
Assembly
OpenShell.Sdk.dll

File transfer between the local machine and a sandbox. Files travel as a tar stream over exec, so the sandbox image needs tar and sh.

public interface IFileClient

Methods

DownloadAsync(string, string, Stream, CancellationToken)

Downloads one remote file into destination.

ValueTask DownloadAsync(string sandbox, string remotePath, Stream destination, CancellationToken cancellationToken = default)

Parameters

sandbox string
remotePath string
destination Stream
cancellationToken CancellationToken

Returns

ValueTask

DownloadAsync(string, string, string, CancellationToken)

Downloads one remote file to localPath. The file is replaced atomically on success.

ValueTask DownloadAsync(string sandbox, string remotePath, string localPath, CancellationToken cancellationToken = default)

Parameters

sandbox string
remotePath string
localPath string
cancellationToken CancellationToken

Returns

ValueTask

DownloadDirectoryAsync(string, string, string, CancellationToken)

Downloads a remote directory tree into localDirectory. Entries that would escape the destination, and links of any kind, are rejected with InvalidDataException.

ValueTask DownloadDirectoryAsync(string sandbox, string remoteDirectory, string localDirectory, CancellationToken cancellationToken = default)

Parameters

sandbox string
remoteDirectory string
localDirectory string
cancellationToken CancellationToken

Returns

ValueTask

UploadAsync(string, Stream, string, UnixFileMode?, CancellationToken)

Uploads content as the file remotePath. A non-seekable stream is buffered in memory first because a tar header needs the size up front.

ValueTask UploadAsync(string sandbox, Stream content, string remotePath, UnixFileMode? mode = null, CancellationToken cancellationToken = default)

Parameters

sandbox string
content Stream
remotePath string
mode UnixFileMode?
cancellationToken CancellationToken

Returns

ValueTask

UploadAsync(string, string, string, CancellationToken)

Uploads one local file to remotePath, creating parent directories.

ValueTask UploadAsync(string sandbox, string localPath, string remotePath, CancellationToken cancellationToken = default)

Parameters

sandbox string
localPath string
remotePath string
cancellationToken CancellationToken

Returns

ValueTask

UploadDirectoryAsync(string, string, string, CancellationToken)

Uploads the contents of a local directory into remoteDirectory, creating it if needed.

ValueTask UploadDirectoryAsync(string sandbox, string localDirectory, string remoteDirectory, CancellationToken cancellationToken = default)

Parameters

sandbox string
localDirectory string
remoteDirectory string
cancellationToken CancellationToken

Returns

ValueTask