A .NET 8 console application for generating large text files. It supports sequential or partitioned generation, configurable output size, content values, batching and optional memory metrics.
{Id}. {Text}
- .NET SDK 8.0+
- OS: Windows, Linux, or macOS
-
Restore and build all projects:
- dotnet restore
- dotnet build -c Release
-
Run the CLI:
- dotnet run -c Release --project FileGenerator.Cli -- -tfs "100MB" -ofp "D:\file.txt"
Notes:
- The double dash
--separates dotnet run options from app options. - Use
-tfs_bytesto specify an exact byte size instead of a human-readable size.
The application binds configuration in this order (later overrides earlier):
- appsettings.json
- Command-line
- -tfs (e.g., "500MB", "1.5GB", "1024MB")
- -tfs_bytes (e.g., 1048576)
- -ofp (e.g., "D:\file.txt")
OutputFilePath is required.
At least one of TargetFileSize or TargetFileSizeBytes is required.
TargetFileSize accepts values like "100MB", "1.5GB", "10KB" or a plain number meaning bytes. Supported units: B, KB, MB, GB.
List of Values should be provided via appsettings.json.
{
"FileGeneration": {
"OutputFilePath": "generatedFile.txt",
"TargetFileSize": "512MB",
"Values": ["alpha", "beta", "gamma"],
"MonitorPeakMemory": true,
"ChannelCapacity": 5000,
"ChanceDuplicate": 5,
"MaxId": 99999,
"FileBatchSize": 4000,
"IsPartitionGeneration": true,
"PartitionCount": 4,
"PartitionBufferSizeMb": 16,
"PartitionFolderPath": "partitions"
}
}- 0: Success
- 130: Cancelled by user (Ctrl+C)
- 2: Configuration error (invalid/missing options)
- 1: Unexpected error