react-native-nitro-unzip 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/android/src/main/java/com/margelo/nitro/unzip/HybridUnzipTask.kt +6 -2
- package/android/src/main/java/com/margelo/nitro/unzip/HybridZipTask.kt +1 -0
- package/ios/HybridUnzipTask.swift +15 -3
- package/ios/HybridZipTask.swift +1 -0
- package/lib/typescript/specs/Unzip.nitro.d.ts +4 -0
- package/lib/typescript/specs/Unzip.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JUnzipResult.hpp +5 -1
- package/nitrogen/generated/android/c++/JZipResult.hpp +5 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/UnzipResult.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/ZipResult.kt +5 -2
- package/nitrogen/generated/ios/swift/UnzipResult.swift +7 -2
- package/nitrogen/generated/ios/swift/ZipResult.swift +7 -2
- package/nitrogen/generated/shared/c++/UnzipResult.hpp +5 -1
- package/nitrogen/generated/shared/c++/ZipResult.hpp +5 -1
- package/package.json +1 -1
- package/src/specs/Unzip.nitro.ts +4 -0
package/README.md
CHANGED
|
@@ -124,9 +124,10 @@ Creates an `Unzip` factory instance.
|
|
|
124
124
|
|---|---|---|
|
|
125
125
|
| `success` | `boolean` | Whether extraction completed |
|
|
126
126
|
| `extractedFiles` | `number` | Total files extracted |
|
|
127
|
+
| `totalFiles` | `number` | Total files in the archive |
|
|
127
128
|
| `duration` | `number` | Duration in milliseconds |
|
|
128
129
|
| `averageSpeed` | `number` | Average files per second |
|
|
129
|
-
| `totalBytes` | `number` |
|
|
130
|
+
| `totalBytes` | `number` | Size of the ZIP file in bytes |
|
|
130
131
|
|
|
131
132
|
### `ZipProgress`
|
|
132
133
|
|
|
@@ -143,6 +144,7 @@ Creates an `Unzip` factory instance.
|
|
|
143
144
|
|---|---|---|
|
|
144
145
|
| `success` | `boolean` | Whether compression completed |
|
|
145
146
|
| `compressedFiles` | `number` | Total files compressed |
|
|
147
|
+
| `totalFiles` | `number` | Total files to compress |
|
|
146
148
|
| `duration` | `number` | Duration in milliseconds |
|
|
147
149
|
| `averageSpeed` | `number` | Average files per second |
|
|
148
150
|
| `totalBytes` | `number` | Total bytes written |
|
|
@@ -163,13 +163,15 @@ class HybridUnzipTask(
|
|
|
163
163
|
|
|
164
164
|
val durationMs = (System.currentTimeMillis() - startTime).toDouble()
|
|
165
165
|
val avgSpeed = if (durationMs > 0) extractedCount / (durationMs / 1000.0) else 0.0
|
|
166
|
+
val zipFileSize = sourceFile.length().toDouble()
|
|
166
167
|
|
|
167
168
|
UnzipResult(
|
|
168
169
|
success = true,
|
|
169
170
|
extractedFiles = extractedCount.toDouble(),
|
|
171
|
+
totalFiles = totalEntries.toDouble(),
|
|
170
172
|
duration = durationMs,
|
|
171
173
|
averageSpeed = avgSpeed,
|
|
172
|
-
totalBytes =
|
|
174
|
+
totalBytes = zipFileSize
|
|
173
175
|
)
|
|
174
176
|
}
|
|
175
177
|
|
|
@@ -239,13 +241,15 @@ class HybridUnzipTask(
|
|
|
239
241
|
|
|
240
242
|
val durationMs = (System.currentTimeMillis() - startTime).toDouble()
|
|
241
243
|
val avgSpeed = if (durationMs > 0) extractedCount / (durationMs / 1000.0) else 0.0
|
|
244
|
+
val zipFileSize = sourceFile.length().toDouble()
|
|
242
245
|
|
|
243
246
|
UnzipResult(
|
|
244
247
|
success = true,
|
|
245
248
|
extractedFiles = extractedCount.toDouble(),
|
|
249
|
+
totalFiles = totalEntries.toDouble(),
|
|
246
250
|
duration = durationMs,
|
|
247
251
|
averageSpeed = avgSpeed,
|
|
248
|
-
totalBytes =
|
|
252
|
+
totalBytes = zipFileSize
|
|
249
253
|
)
|
|
250
254
|
}
|
|
251
255
|
|
|
@@ -130,10 +130,11 @@ class HybridUnzipTask: HybridUnzipTaskSpec {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
var extractedFiles = 0
|
|
133
|
+
var totalFileCount = 0
|
|
133
134
|
var lastProgressUpdate = Date()
|
|
134
135
|
|
|
135
136
|
// SSZipArchive progress handler — called per file
|
|
136
|
-
let progressHandler: (String, unz_file_info, Int, Int) -> Void = { [weak self] _,
|
|
137
|
+
let progressHandler: (String, unz_file_info, Int, Int) -> Void = { [weak self] _, fileInfo, entryNumber, total in
|
|
137
138
|
guard let self = self else { return }
|
|
138
139
|
|
|
139
140
|
// Check cancellation
|
|
@@ -144,6 +145,7 @@ class HybridUnzipTask: HybridUnzipTaskSpec {
|
|
|
144
145
|
if cancelled { return }
|
|
145
146
|
|
|
146
147
|
extractedFiles = entryNumber
|
|
148
|
+
totalFileCount = total
|
|
147
149
|
|
|
148
150
|
// Throttle progress updates
|
|
149
151
|
let now = Date()
|
|
@@ -161,7 +163,7 @@ class HybridUnzipTask: HybridUnzipTaskSpec {
|
|
|
161
163
|
totalFiles: Double(total),
|
|
162
164
|
progress: progress,
|
|
163
165
|
speed: speed,
|
|
164
|
-
processedBytes:
|
|
166
|
+
processedBytes: Double(fileInfo.uncompressed_size)
|
|
165
167
|
))
|
|
166
168
|
lastProgressUpdate = now
|
|
167
169
|
}
|
|
@@ -202,12 +204,22 @@ class HybridUnzipTask: HybridUnzipTaskSpec {
|
|
|
202
204
|
let finalCount = extractedFiles
|
|
203
205
|
let averageSpeed = duration > 0 ? Double(finalCount) / (duration / 1000) : 0
|
|
204
206
|
|
|
207
|
+
// Calculate total bytes from extracted files
|
|
208
|
+
let totalBytes: Double
|
|
209
|
+
if let attrs = try? fileManager.attributesOfItem(atPath: cleanZip),
|
|
210
|
+
let fileSize = attrs[.size] as? UInt64 {
|
|
211
|
+
totalBytes = Double(fileSize)
|
|
212
|
+
} else {
|
|
213
|
+
totalBytes = 0
|
|
214
|
+
}
|
|
215
|
+
|
|
205
216
|
return UnzipResult(
|
|
206
217
|
success: true,
|
|
207
218
|
extractedFiles: Double(finalCount),
|
|
219
|
+
totalFiles: Double(totalFileCount),
|
|
208
220
|
duration: duration,
|
|
209
221
|
averageSpeed: averageSpeed,
|
|
210
|
-
totalBytes:
|
|
222
|
+
totalBytes: totalBytes
|
|
211
223
|
)
|
|
212
224
|
}
|
|
213
225
|
|
package/ios/HybridZipTask.swift
CHANGED
|
@@ -22,6 +22,8 @@ export interface UnzipResult {
|
|
|
22
22
|
success: boolean;
|
|
23
23
|
/** Total number of files extracted */
|
|
24
24
|
extractedFiles: number;
|
|
25
|
+
/** Total number of files in the archive */
|
|
26
|
+
totalFiles: number;
|
|
25
27
|
/** Total extraction duration in milliseconds */
|
|
26
28
|
duration: number;
|
|
27
29
|
/** Average extraction speed in files per second */
|
|
@@ -77,6 +79,8 @@ export interface ZipResult {
|
|
|
77
79
|
success: boolean;
|
|
78
80
|
/** Total number of files compressed */
|
|
79
81
|
compressedFiles: number;
|
|
82
|
+
/** Total number of files to compress */
|
|
83
|
+
totalFiles: number;
|
|
80
84
|
/** Total compression duration in milliseconds */
|
|
81
85
|
duration: number;
|
|
82
86
|
/** Average compression speed in files per second */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unzip.nitro.d.ts","sourceRoot":"","sources":["../../../src/specs/Unzip.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI/D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,cAAc,EAAE,MAAM,CAAC;I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;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,OACf,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;IACzD,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,UAAU,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI,CAAC;IAE5D,6DAA6D;IAC7D,MAAM,IAAI,IAAI,CAAC;IAEf;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;CAC7B;AAID;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,KACf,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;IACzD;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAE7D;;;;;;OAMG;IACH,mBAAmB,CACjB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,GACf,SAAS,CAAC;IAEb;;;;;OAKG;IACH,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC;IAE7D;;;;;;;OAOG;IACH,eAAe,CACb,UAAU,EAAE,MAAM,EAClB,kBAAkB,EAAE,MAAM,EAC1B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;CACZ"}
|
|
@@ -35,6 +35,8 @@ namespace margelo::nitro::unzip {
|
|
|
35
35
|
jboolean success = this->getFieldValue(fieldSuccess);
|
|
36
36
|
static const auto fieldExtractedFiles = clazz->getField<double>("extractedFiles");
|
|
37
37
|
double extractedFiles = this->getFieldValue(fieldExtractedFiles);
|
|
38
|
+
static const auto fieldTotalFiles = clazz->getField<double>("totalFiles");
|
|
39
|
+
double totalFiles = this->getFieldValue(fieldTotalFiles);
|
|
38
40
|
static const auto fieldDuration = clazz->getField<double>("duration");
|
|
39
41
|
double duration = this->getFieldValue(fieldDuration);
|
|
40
42
|
static const auto fieldAverageSpeed = clazz->getField<double>("averageSpeed");
|
|
@@ -44,6 +46,7 @@ namespace margelo::nitro::unzip {
|
|
|
44
46
|
return UnzipResult(
|
|
45
47
|
static_cast<bool>(success),
|
|
46
48
|
extractedFiles,
|
|
49
|
+
totalFiles,
|
|
47
50
|
duration,
|
|
48
51
|
averageSpeed,
|
|
49
52
|
totalBytes
|
|
@@ -56,13 +59,14 @@ namespace margelo::nitro::unzip {
|
|
|
56
59
|
*/
|
|
57
60
|
[[maybe_unused]]
|
|
58
61
|
static jni::local_ref<JUnzipResult::javaobject> fromCpp(const UnzipResult& value) {
|
|
59
|
-
using JSignature = JUnzipResult(jboolean, double, double, double, double);
|
|
62
|
+
using JSignature = JUnzipResult(jboolean, double, double, double, double, double);
|
|
60
63
|
static const auto clazz = javaClassStatic();
|
|
61
64
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
62
65
|
return create(
|
|
63
66
|
clazz,
|
|
64
67
|
value.success,
|
|
65
68
|
value.extractedFiles,
|
|
69
|
+
value.totalFiles,
|
|
66
70
|
value.duration,
|
|
67
71
|
value.averageSpeed,
|
|
68
72
|
value.totalBytes
|
|
@@ -35,6 +35,8 @@ namespace margelo::nitro::unzip {
|
|
|
35
35
|
jboolean success = this->getFieldValue(fieldSuccess);
|
|
36
36
|
static const auto fieldCompressedFiles = clazz->getField<double>("compressedFiles");
|
|
37
37
|
double compressedFiles = this->getFieldValue(fieldCompressedFiles);
|
|
38
|
+
static const auto fieldTotalFiles = clazz->getField<double>("totalFiles");
|
|
39
|
+
double totalFiles = this->getFieldValue(fieldTotalFiles);
|
|
38
40
|
static const auto fieldDuration = clazz->getField<double>("duration");
|
|
39
41
|
double duration = this->getFieldValue(fieldDuration);
|
|
40
42
|
static const auto fieldAverageSpeed = clazz->getField<double>("averageSpeed");
|
|
@@ -44,6 +46,7 @@ namespace margelo::nitro::unzip {
|
|
|
44
46
|
return ZipResult(
|
|
45
47
|
static_cast<bool>(success),
|
|
46
48
|
compressedFiles,
|
|
49
|
+
totalFiles,
|
|
47
50
|
duration,
|
|
48
51
|
averageSpeed,
|
|
49
52
|
totalBytes
|
|
@@ -56,13 +59,14 @@ namespace margelo::nitro::unzip {
|
|
|
56
59
|
*/
|
|
57
60
|
[[maybe_unused]]
|
|
58
61
|
static jni::local_ref<JZipResult::javaobject> fromCpp(const ZipResult& value) {
|
|
59
|
-
using JSignature = JZipResult(jboolean, double, double, double, double);
|
|
62
|
+
using JSignature = JZipResult(jboolean, double, double, double, double, double);
|
|
60
63
|
static const auto clazz = javaClassStatic();
|
|
61
64
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
62
65
|
return create(
|
|
63
66
|
clazz,
|
|
64
67
|
value.success,
|
|
65
68
|
value.compressedFiles,
|
|
69
|
+
value.totalFiles,
|
|
66
70
|
value.duration,
|
|
67
71
|
value.averageSpeed,
|
|
68
72
|
value.totalBytes
|
|
@@ -25,6 +25,9 @@ data class UnzipResult(
|
|
|
25
25
|
val extractedFiles: Double,
|
|
26
26
|
@DoNotStrip
|
|
27
27
|
@Keep
|
|
28
|
+
val totalFiles: Double,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
28
31
|
val duration: Double,
|
|
29
32
|
@DoNotStrip
|
|
30
33
|
@Keep
|
|
@@ -43,8 +46,8 @@ data class UnzipResult(
|
|
|
43
46
|
@Keep
|
|
44
47
|
@Suppress("unused")
|
|
45
48
|
@JvmStatic
|
|
46
|
-
private fun fromCpp(success: Boolean, extractedFiles: Double, duration: Double, averageSpeed: Double, totalBytes: Double): UnzipResult {
|
|
47
|
-
return UnzipResult(success, extractedFiles, duration, averageSpeed, totalBytes)
|
|
49
|
+
private fun fromCpp(success: Boolean, extractedFiles: Double, totalFiles: Double, duration: Double, averageSpeed: Double, totalBytes: Double): UnzipResult {
|
|
50
|
+
return UnzipResult(success, extractedFiles, totalFiles, duration, averageSpeed, totalBytes)
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
}
|
|
@@ -25,6 +25,9 @@ data class ZipResult(
|
|
|
25
25
|
val compressedFiles: Double,
|
|
26
26
|
@DoNotStrip
|
|
27
27
|
@Keep
|
|
28
|
+
val totalFiles: Double,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
28
31
|
val duration: Double,
|
|
29
32
|
@DoNotStrip
|
|
30
33
|
@Keep
|
|
@@ -43,8 +46,8 @@ data class ZipResult(
|
|
|
43
46
|
@Keep
|
|
44
47
|
@Suppress("unused")
|
|
45
48
|
@JvmStatic
|
|
46
|
-
private fun fromCpp(success: Boolean, compressedFiles: Double, duration: Double, averageSpeed: Double, totalBytes: Double): ZipResult {
|
|
47
|
-
return ZipResult(success, compressedFiles, duration, averageSpeed, totalBytes)
|
|
49
|
+
private fun fromCpp(success: Boolean, compressedFiles: Double, totalFiles: Double, duration: Double, averageSpeed: Double, totalBytes: Double): ZipResult {
|
|
50
|
+
return ZipResult(success, compressedFiles, totalFiles, duration, averageSpeed, totalBytes)
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
}
|
|
@@ -18,8 +18,8 @@ public extension UnzipResult {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `UnzipResult`.
|
|
20
20
|
*/
|
|
21
|
-
init(success: Bool, extractedFiles: Double, duration: Double, averageSpeed: Double, totalBytes: Double) {
|
|
22
|
-
self.init(success, extractedFiles, duration, averageSpeed, totalBytes)
|
|
21
|
+
init(success: Bool, extractedFiles: Double, totalFiles: Double, duration: Double, averageSpeed: Double, totalBytes: Double) {
|
|
22
|
+
self.init(success, extractedFiles, totalFiles, duration, averageSpeed, totalBytes)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
@inline(__always)
|
|
@@ -32,6 +32,11 @@ public extension UnzipResult {
|
|
|
32
32
|
return self.__extractedFiles
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
@inline(__always)
|
|
36
|
+
var totalFiles: Double {
|
|
37
|
+
return self.__totalFiles
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
@inline(__always)
|
|
36
41
|
var duration: Double {
|
|
37
42
|
return self.__duration
|
|
@@ -18,8 +18,8 @@ public extension ZipResult {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `ZipResult`.
|
|
20
20
|
*/
|
|
21
|
-
init(success: Bool, compressedFiles: Double, duration: Double, averageSpeed: Double, totalBytes: Double) {
|
|
22
|
-
self.init(success, compressedFiles, duration, averageSpeed, totalBytes)
|
|
21
|
+
init(success: Bool, compressedFiles: Double, totalFiles: Double, duration: Double, averageSpeed: Double, totalBytes: Double) {
|
|
22
|
+
self.init(success, compressedFiles, totalFiles, duration, averageSpeed, totalBytes)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
@inline(__always)
|
|
@@ -32,6 +32,11 @@ public extension ZipResult {
|
|
|
32
32
|
return self.__compressedFiles
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
@inline(__always)
|
|
36
|
+
var totalFiles: Double {
|
|
37
|
+
return self.__totalFiles
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
@inline(__always)
|
|
36
41
|
var duration: Double {
|
|
37
42
|
return self.__duration
|
|
@@ -41,13 +41,14 @@ namespace margelo::nitro::unzip {
|
|
|
41
41
|
public:
|
|
42
42
|
bool success SWIFT_PRIVATE;
|
|
43
43
|
double extractedFiles SWIFT_PRIVATE;
|
|
44
|
+
double totalFiles SWIFT_PRIVATE;
|
|
44
45
|
double duration SWIFT_PRIVATE;
|
|
45
46
|
double averageSpeed SWIFT_PRIVATE;
|
|
46
47
|
double totalBytes SWIFT_PRIVATE;
|
|
47
48
|
|
|
48
49
|
public:
|
|
49
50
|
UnzipResult() = default;
|
|
50
|
-
explicit UnzipResult(bool success, double extractedFiles, double duration, double averageSpeed, double totalBytes): success(success), extractedFiles(extractedFiles), duration(duration), averageSpeed(averageSpeed), totalBytes(totalBytes) {}
|
|
51
|
+
explicit UnzipResult(bool success, double extractedFiles, double totalFiles, double duration, double averageSpeed, double totalBytes): success(success), extractedFiles(extractedFiles), totalFiles(totalFiles), duration(duration), averageSpeed(averageSpeed), totalBytes(totalBytes) {}
|
|
51
52
|
|
|
52
53
|
public:
|
|
53
54
|
friend bool operator==(const UnzipResult& lhs, const UnzipResult& rhs) = default;
|
|
@@ -65,6 +66,7 @@ namespace margelo::nitro {
|
|
|
65
66
|
return margelo::nitro::unzip::UnzipResult(
|
|
66
67
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "success"))),
|
|
67
68
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "extractedFiles"))),
|
|
69
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalFiles"))),
|
|
68
70
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration"))),
|
|
69
71
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "averageSpeed"))),
|
|
70
72
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalBytes")))
|
|
@@ -74,6 +76,7 @@ namespace margelo::nitro {
|
|
|
74
76
|
jsi::Object obj(runtime);
|
|
75
77
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "success"), JSIConverter<bool>::toJSI(runtime, arg.success));
|
|
76
78
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "extractedFiles"), JSIConverter<double>::toJSI(runtime, arg.extractedFiles));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "totalFiles"), JSIConverter<double>::toJSI(runtime, arg.totalFiles));
|
|
77
80
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<double>::toJSI(runtime, arg.duration));
|
|
78
81
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "averageSpeed"), JSIConverter<double>::toJSI(runtime, arg.averageSpeed));
|
|
79
82
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "totalBytes"), JSIConverter<double>::toJSI(runtime, arg.totalBytes));
|
|
@@ -89,6 +92,7 @@ namespace margelo::nitro {
|
|
|
89
92
|
}
|
|
90
93
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "success")))) return false;
|
|
91
94
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "extractedFiles")))) return false;
|
|
95
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalFiles")))) return false;
|
|
92
96
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;
|
|
93
97
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "averageSpeed")))) return false;
|
|
94
98
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalBytes")))) return false;
|
|
@@ -41,13 +41,14 @@ namespace margelo::nitro::unzip {
|
|
|
41
41
|
public:
|
|
42
42
|
bool success SWIFT_PRIVATE;
|
|
43
43
|
double compressedFiles SWIFT_PRIVATE;
|
|
44
|
+
double totalFiles SWIFT_PRIVATE;
|
|
44
45
|
double duration SWIFT_PRIVATE;
|
|
45
46
|
double averageSpeed SWIFT_PRIVATE;
|
|
46
47
|
double totalBytes SWIFT_PRIVATE;
|
|
47
48
|
|
|
48
49
|
public:
|
|
49
50
|
ZipResult() = default;
|
|
50
|
-
explicit ZipResult(bool success, double compressedFiles, double duration, double averageSpeed, double totalBytes): success(success), compressedFiles(compressedFiles), duration(duration), averageSpeed(averageSpeed), totalBytes(totalBytes) {}
|
|
51
|
+
explicit ZipResult(bool success, double compressedFiles, double totalFiles, double duration, double averageSpeed, double totalBytes): success(success), compressedFiles(compressedFiles), totalFiles(totalFiles), duration(duration), averageSpeed(averageSpeed), totalBytes(totalBytes) {}
|
|
51
52
|
|
|
52
53
|
public:
|
|
53
54
|
friend bool operator==(const ZipResult& lhs, const ZipResult& rhs) = default;
|
|
@@ -65,6 +66,7 @@ namespace margelo::nitro {
|
|
|
65
66
|
return margelo::nitro::unzip::ZipResult(
|
|
66
67
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "success"))),
|
|
67
68
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compressedFiles"))),
|
|
69
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalFiles"))),
|
|
68
70
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration"))),
|
|
69
71
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "averageSpeed"))),
|
|
70
72
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalBytes")))
|
|
@@ -74,6 +76,7 @@ namespace margelo::nitro {
|
|
|
74
76
|
jsi::Object obj(runtime);
|
|
75
77
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "success"), JSIConverter<bool>::toJSI(runtime, arg.success));
|
|
76
78
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "compressedFiles"), JSIConverter<double>::toJSI(runtime, arg.compressedFiles));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "totalFiles"), JSIConverter<double>::toJSI(runtime, arg.totalFiles));
|
|
77
80
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<double>::toJSI(runtime, arg.duration));
|
|
78
81
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "averageSpeed"), JSIConverter<double>::toJSI(runtime, arg.averageSpeed));
|
|
79
82
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "totalBytes"), JSIConverter<double>::toJSI(runtime, arg.totalBytes));
|
|
@@ -89,6 +92,7 @@ namespace margelo::nitro {
|
|
|
89
92
|
}
|
|
90
93
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "success")))) return false;
|
|
91
94
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compressedFiles")))) return false;
|
|
95
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalFiles")))) return false;
|
|
92
96
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;
|
|
93
97
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "averageSpeed")))) return false;
|
|
94
98
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalBytes")))) return false;
|
package/package.json
CHANGED
package/src/specs/Unzip.nitro.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface UnzipResult {
|
|
|
26
26
|
success: boolean;
|
|
27
27
|
/** Total number of files extracted */
|
|
28
28
|
extractedFiles: number;
|
|
29
|
+
/** Total number of files in the archive */
|
|
30
|
+
totalFiles: number;
|
|
29
31
|
/** Total extraction duration in milliseconds */
|
|
30
32
|
duration: number;
|
|
31
33
|
/** Average extraction speed in files per second */
|
|
@@ -87,6 +89,8 @@ export interface ZipResult {
|
|
|
87
89
|
success: boolean;
|
|
88
90
|
/** Total number of files compressed */
|
|
89
91
|
compressedFiles: number;
|
|
92
|
+
/** Total number of files to compress */
|
|
93
|
+
totalFiles: number;
|
|
90
94
|
/** Total compression duration in milliseconds */
|
|
91
95
|
duration: number;
|
|
92
96
|
/** Average compression speed in files per second */
|