@xec-sh/core
Version:
Universal shell execution engine
63 lines (62 loc) • 1.86 kB
TypeScript
import type { CallableExecutionEngine } from '../types/engine.js';
import type { ExecutionEngine } from '../core/execution-engine.js';
export interface TransferOptions {
overwrite?: boolean;
preserveMode?: boolean;
preserveTimestamps?: boolean;
recursive?: boolean;
followSymlinks?: boolean;
onProgress?: (progress: TransferProgress) => void;
include?: string[];
exclude?: string[];
concurrent?: number;
chunkSize?: number;
compress?: boolean;
deleteExtra?: boolean;
}
export interface TransferProgress {
totalFiles: number;
completedFiles: number;
totalBytes: number;
transferredBytes: number;
currentFile?: string;
speed?: number;
}
export interface TransferResult {
success: boolean;
filesTransferred: number;
bytesTransferred: number;
errors?: Error[];
duration: number;
}
export interface Environment {
type: 'local' | 'ssh' | 'docker';
host?: string;
user?: string;
container?: string;
path: string;
raw: string;
}
export declare class TransferEngine {
private engine;
constructor(engine: ExecutionEngine | CallableExecutionEngine);
private emitEvent;
copy(source: string, dest: string, options?: TransferOptions): Promise<TransferResult>;
move(source: string, dest: string, options?: TransferOptions): Promise<TransferResult>;
sync(source: string, dest: string, options?: TransferOptions): Promise<TransferResult>;
private parseEnvironment;
private executeTransfer;
private localToLocal;
private localToSsh;
private localToDocker;
private sshToLocal;
private sshToSsh;
private sshToDocker;
private dockerToLocal;
private dockerToSsh;
private dockerToDocker;
private buildCpFlags;
private buildScpFlags;
private buildExcludeFlags;
private getTransferStats;
}