Models:
-
DownloadOptions- Configuration record for download operations with properties:BucketName(required)LocalPath(required)Region(optional, defaults to AWS SDK default)Prefix(optional, for filtering S3 objects)OverwriteExisting(boolean, defaults to false)MaxConcurrency(integer, defaults to 5)
-
DownloadProgress- Real-time progress tracking record with:Key- S3 object keyTotalBytes- File sizeDownloadedBytes- Bytes downloaded so farLocalFilePath- Destination pathIsComplete- Completion statusErrorMessage- Error details if failed
-
DownloadResult- Download operation summary record with:SuccessCount- Number of successfully downloaded filesFailureCount- Number of failed downloadsTotalBytesDownloaded- Total bytes downloadedFailures- List of failed downloads with error messagesIsSuccess- Computed property indicating complete success
Services:
-
IS3DownloaderService- Interface defining:DownloadBucketAsync()- Download bucket contents with progress callbackListObjectsAsync()- List S3 objects with optional prefix
-
S3DownloaderService- Implementation featuring:- AWS SDK v3 integration
- Concurrent downloads with semaphore-based concurrency control
- Stream-based file downloads (memory efficient)
- Comprehensive logging via ILogger
- Error handling and reporting
- Support for prefix-based filtering
- Region-specific bucket access
Features:
- Beautiful ASCII/ANSI console UI using Spectre.Console
- Interactive prompts for:
- S3 bucket name
- Optional prefix filtering
- Local download path
- AWS region selection
- Overwrite existing files option
- Max concurrent downloads configuration
- Real-time progress tracking with visual indicators
- Summary statistics after download completion
- Error reporting with detailed failure messages
- Dependency injection setup for services
Architecture:
Program.cs- Entry point with DI configurationApplication.cs- Main application logic orchestrating UI and service callsappsettings.json- Configuration file
Created comprehensive unit tests using xUnit v3:
Model Tests:
DownloadOptionsTests- Tests for options creation and record equalityDownloadProgressTests- Tests for progress tracking and error handlingDownloadResultTests- Tests for result computation and success determination
Service Tests:
S3DownloaderServiceTests- Tests for:- Parameter validation (null checks)
- Service initialization
- Download operation results
Each test follows the AAA (Arrange, Act, Assert) pattern with clear comments.
SimpleAWS.S3.Downloader/
├── src/
│ ├── SimpleAWS.S3.Downloader.Core/
│ │ ├── Models/
│ │ │ ├── DownloadOptions.cs
│ │ │ ├── DownloadProgress.cs
│ │ │ └── DownloadResult.cs
│ │ ├── Services/
│ │ │ ├── IS3DownloaderService.cs
│ │ │ └── S3DownloaderService.cs
│ │ └── SimpleAWS.S3.Downloader.Core.csproj
│ └── SimpleAWS.S3.Downloader.Console/
│ ├── Application.cs
│ ├── Program.cs
│ ├── appsettings.json
│ └── SimpleAWS.S3.Downloader.Console.csproj
├── tests/
│ └── SimpleAWS.S3.Downloader.Tests/
│ ├── Models/
│ │ ├── DownloadOptionsTests.cs
│ │ ├── DownloadProgressTests.cs
│ │ └── DownloadResultTests.cs
│ ├── Services/
│ │ └── S3DownloaderServiceTests.cs
│ └── SimpleAWS.S3.Downloader.Tests.csproj
├── README.md
└── SimpleAWS.S3.Downloader.sln
- .NET: .NET 10
- AWS SDK: AWSSDK.S3 v4.0.18.6
- Logging: Microsoft.Extensions.Logging v10.0.3
- Configuration: Microsoft.Extensions.Configuration.Json v10.0.0
- Console UI: Spectre.Console v0.54.0
- Testing: xUnit v3.2.1 with NSubstitute for mocking
- Dependency Injection: Microsoft.Extensions.DependencyInjection
Following the GitHub Copilot Instructions for the project:
✅ Modern C# features (records, nullable reference types, file-scoped namespaces)
✅ async/await for all I/O operations
✅ ConfigureAwait(false) in library code
✅ Meaningful exception handling with proper validation
✅ Structured logging with appropriate log levels
✅ XML documentation comments for all public APIs
✅ Dependency injection pattern
✅ SOLID principles (Single Responsibility, Interface Segregation)
✅ Stream-based processing for memory efficiency
✅ Unit tests with AAA pattern
dotnet builddotnet run --project src/SimpleAWS.S3.Downloader.Consoledotnet testdotnet build -c Release- Add integration tests with mock S3 bucket (LocalStack)
- Implement resume capability for interrupted downloads
- Add bandwidth throttling options
- Support for S3 encryption settings
- Multi-part upload optimization for large files
- Configuration file support for persistent settings
- Add command-line argument parsing for non-interactive mode
- Implement retry logic with exponential backoff
- Add download verification (MD5/ETag checking)
- Clean Architecture: Core business logic separated from console UI
- Error Resilience: Partial failures don't stop the entire operation
- User Experience: Real-time progress, clear prompts, beautiful output
- Testability: Dependency injection and interface-based design
- Performance: Concurrent downloads with configurable parallelism
- Maintainability: Well-documented code following C# best practices