s3-cli-js
Version:
A TypeScript-based npm package that replaces AWS CLI for S3 operations using presigned URLs
127 lines • 2.96 kB
TypeScript
/**
* Type definitions for S3 CLI operations
*/
export interface S3Config {
region: string;
accessKeyId: string;
secretAccessKey: string;
sessionToken?: string;
endpoint?: string;
}
export interface S3Object {
key: string;
size: number;
lastModified: Date;
etag: string;
storageClass?: string;
}
export interface S3Bucket {
name: string;
creationDate: Date;
}
export interface ListObjectsOptions {
bucket: string;
prefix?: string;
delimiter?: string;
maxKeys?: number;
continuationToken?: string;
}
export interface ListObjectsResult {
objects: S3Object[];
commonPrefixes: string[];
isTruncated: boolean;
nextContinuationToken?: string;
}
export interface CopyOptions {
recursive?: boolean;
dryRun?: boolean;
exclude?: string[];
include?: string[];
concurrency?: number;
}
export interface SyncOptions {
source: string;
destination: string;
delete?: boolean;
dryRun?: boolean;
exclude?: string[];
include?: string[];
concurrency?: number;
sizeOnly?: boolean;
exactTimestamps?: boolean;
checksum?: boolean;
noChecksum?: boolean;
force?: boolean;
}
export interface UploadProgress {
loaded: number;
total: number;
percentage: number;
}
export interface DownloadProgress {
loaded: number;
total: number;
percentage: number;
}
export type ProgressCallback = (progress: UploadProgress | DownloadProgress) => void;
export interface PresignedUrlOptions {
bucket: string;
key: string;
operation: 'getObject' | 'putObject' | 'deleteObject';
expiresIn?: number;
contentType?: string;
}
export interface HttpRequestOptions {
method: 'GET' | 'PUT' | 'POST' | 'DELETE';
url: string;
headers?: Record<string, string>;
data?: Buffer | string;
onProgress?: ProgressCallback;
}
export interface FileOperation {
type: 'upload' | 'download';
localPath: string;
bucket: string;
key: string;
size?: number;
}
export interface ConcurrentProgress {
completed: number;
total: number;
failed: number;
inProgress: number;
totalBytes: number;
completedBytes: number;
}
export interface FileInfo {
path: string;
size: number;
lastModified: Date;
etag?: string;
md5?: string;
isDirectory?: boolean;
}
export interface SyncAction {
type: 'upload' | 'download' | 'delete' | 'skip';
reason: string;
sourceFile?: FileInfo;
destFile?: FileInfo;
localPath: string;
remotePath: string;
bucket?: string;
key?: string;
}
export interface SyncResult {
actions: SyncAction[];
uploaded: number;
downloaded: number;
deleted: number;
skipped: number;
totalBytes: number;
errors: Array<{
action: SyncAction;
error: Error;
}>;
}
export type SyncCompareResult = 'upload' | 'download' | 'skip' | 'conflict';
//# sourceMappingURL=types.d.ts.map