Line data Source code
1 : import 'package:flutter/foundation.dart';
2 : import '../worker.dart';
3 :
4 : /// File decompression worker configuration.
5 : ///
6 : /// Extracts files from ZIP archives with streaming extraction and security protections.
7 : ///
8 : /// **Note:** Password-protected ZIPs and selective extraction will be added in v1.1.0.
9 : /// Current version supports basic ZIP extraction only.
10 : @immutable
11 : final class FileDecompressionWorker extends Worker {
12 3 : const FileDecompressionWorker({
13 : required this.zipPath,
14 : required this.targetDir,
15 : this.deleteAfterExtract = false,
16 : this.overwrite = true,
17 : });
18 :
19 : /// Path to ZIP archive to extract.
20 : final String zipPath;
21 :
22 : /// Destination directory where files will be extracted.
23 : final String targetDir;
24 :
25 : /// Whether to delete archive after successful extraction.
26 : final bool deleteAfterExtract;
27 :
28 : /// Whether to overwrite existing files in destination.
29 : final bool overwrite;
30 :
31 3 : @override
32 : String get workerClassName => 'FileDecompressionWorker';
33 :
34 3 : @override
35 3 : Map<String, dynamic> toMap() => {
36 : 'workerType': 'fileDecompress',
37 3 : 'zipPath': zipPath,
38 3 : 'targetDir': targetDir,
39 3 : 'deleteAfterExtract': deleteAfterExtract,
40 3 : 'overwrite': overwrite,
41 : };
42 : }
|