react-native-zip-archive 7.0.1-dev.0 → 7.0.1
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 +4 -0
- package/android/src/main/java/com/rnziparchive/RNZipArchiveModule.java +1 -1
- package/index.js +17 -4
- package/package.json +1 -1
- package/pnpm-lock.yaml +0 -7095
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@ Zip archive utility for react-native
|
|
|
6
6
|
|
|
7
7
|
In order to comply with the new privacy policy of the App Store on iOS, you need to upgrade react-native-zip-archive to version 7.0.0, which requires the deployment target to be iOS 15.5 or later.
|
|
8
8
|
|
|
9
|
+
## For Expo Users
|
|
10
|
+
|
|
11
|
+
The only way to make this work with Expo is to create a [dev build](https://docs.expo.dev/workflow/overview/#development-builds), the expo go is not supported.
|
|
12
|
+
|
|
9
13
|
## Compatibility
|
|
10
14
|
|
|
11
15
|
| react-native version | react-native-zip-archive version |
|
|
@@ -421,7 +421,7 @@ public class RNZipArchiveModule extends ReactContextBaseJavaModule {
|
|
|
421
421
|
long totalSize = getUncompressedSize(zipFilePath, charset);
|
|
422
422
|
promise.resolve((double) totalSize);
|
|
423
423
|
}
|
|
424
|
-
|
|
424
|
+
|
|
425
425
|
/**
|
|
426
426
|
* Return the uncompressed size of the ZipFile (only works for files on disk, not in assets)
|
|
427
427
|
*
|
package/index.js
CHANGED
|
@@ -10,7 +10,11 @@ const normalizeFilePath = (path) =>
|
|
|
10
10
|
path.startsWith("file://") ? path.slice(7) : path;
|
|
11
11
|
|
|
12
12
|
export const unzip = (source, target, charset = "UTF-8") => {
|
|
13
|
-
return RNZipArchive.unzip(
|
|
13
|
+
return RNZipArchive.unzip(
|
|
14
|
+
normalizeFilePath(source),
|
|
15
|
+
normalizeFilePath(target),
|
|
16
|
+
charset
|
|
17
|
+
);
|
|
14
18
|
};
|
|
15
19
|
export const isPasswordProtected = (source) => {
|
|
16
20
|
return RNZipArchive.isPasswordProtected(normalizeFilePath(source)).then(
|
|
@@ -49,8 +53,14 @@ export const zipWithPassword = (
|
|
|
49
53
|
|
|
50
54
|
export const zip = (source, target) => {
|
|
51
55
|
return Array.isArray(source)
|
|
52
|
-
? RNZipArchive.zipFiles(
|
|
53
|
-
|
|
56
|
+
? RNZipArchive.zipFiles(
|
|
57
|
+
source.map(normalizeFilePath),
|
|
58
|
+
normalizeFilePath(target)
|
|
59
|
+
)
|
|
60
|
+
: RNZipArchive.zipFolder(
|
|
61
|
+
normalizeFilePath(source),
|
|
62
|
+
normalizeFilePath(target)
|
|
63
|
+
);
|
|
54
64
|
};
|
|
55
65
|
|
|
56
66
|
export const unzipAssets = (source, target) => {
|
|
@@ -58,7 +68,10 @@ export const unzipAssets = (source, target) => {
|
|
|
58
68
|
throw new Error("unzipAssets not supported on this platform");
|
|
59
69
|
}
|
|
60
70
|
|
|
61
|
-
return RNZipArchive.unzipAssets(
|
|
71
|
+
return RNZipArchive.unzipAssets(
|
|
72
|
+
normalizeFilePath(source),
|
|
73
|
+
normalizeFilePath(target)
|
|
74
|
+
);
|
|
62
75
|
};
|
|
63
76
|
|
|
64
77
|
export const subscribe = (callback) => {
|
package/package.json
CHANGED