Line data Source code
1 : import 'package:flutter/foundation.dart';
2 : import '../worker.dart';
3 :
4 : /// File compression worker configuration.
5 : ///
6 : /// Compresses files or directories into ZIP archives.
7 : @immutable
8 : final class FileCompressionWorker extends Worker {
9 4 : const FileCompressionWorker({
10 : required this.inputPath,
11 : required this.outputPath,
12 : this.level = CompressionLevel.medium,
13 : this.excludePatterns = const [],
14 : this.deleteOriginal = false,
15 : });
16 :
17 : /// Path to file or directory to compress.
18 : final String inputPath;
19 :
20 : /// Path where ZIP file will be saved.
21 : final String outputPath;
22 :
23 : /// Compression level (low, medium, high).
24 : final CompressionLevel level;
25 :
26 : /// Patterns to exclude from compression.
27 : final List<String> excludePatterns;
28 :
29 : /// Whether to delete original files after compression.
30 : final bool deleteOriginal;
31 :
32 3 : @override
33 : String get workerClassName => 'FileCompressionWorker';
34 :
35 3 : @override
36 3 : Map<String, dynamic> toMap() => {
37 : 'workerType': 'fileCompress',
38 3 : 'inputPath': inputPath,
39 3 : 'outputPath': outputPath,
40 6 : 'compressionLevel': level.name,
41 3 : 'excludePatterns': excludePatterns,
42 3 : 'deleteOriginal': deleteOriginal,
43 : };
44 : }
|