Comments (6)
Not very sure about what wrong with the first case, since I'm not familiar with native android development, so you can feel free to open a PR to correct this bug.
from react-native-zip-archive.
Try to mkdir your subfolders of your zip... I know it's weird but it worked for me
from react-native-zip-archive.
it worked for me
@MadisonBlake
Android => RNZipArchiveModule.java:73
import java.io.BufferedInputStream;
private void unzipStream(String zipFilePath, String destDirectory, InputStream inputStream, long totalSize, Callback completionCallback) {
try {
File destDir = new File(destDirectory);
if (!destDir.exists()) {
destDir.mkdirs();
}
ZipInputStream zipIn = new ZipInputStream(inputStream);
BufferedInputStream bin = new BufferedInputStream(zipIn);
ZipEntry entry;
long extractedBytes = 0;
updateProgress(0, 1, zipFilePath); // force 0%
File fout=null;
while((entry = zipIn.getNextEntry())!=null){
if(entry.isDirectory()) continue;
fout=new File(destDirectory, entry.getName());
if(!fout.exists()){
(new File(fout.getParent())).mkdirs();
}
FileOutputStream out=new FileOutputStream(fout);
BufferedOutputStream Bout=new BufferedOutputStream(out);
int b;
while((b=bin.read())!=-1){
Bout.write(b);
}
Bout.close();
out.close();
}
updateProgress(1, 1, zipFilePath); // force 100%
bin.close();
zipIn.close();
completionCallback.invoke(null, null);
} catch (Exception ex) {
ex.printStackTrace();
updateProgress(0, 1, zipFilePath); // force 0%
completionCallback.invoke(makeErrorPayload(String.format("Couldn't extract %s", zipFilePath), ex));
}
}
from react-native-zip-archive.
@hujiudeyang There's some formatting issue, can you update the comment to fix it? Also, you can directly make a PR to improve that, which will be very grateful.
from react-native-zip-archive.
Hi, I've been trying to find another solution because this isn't helping, I tried everything I have in mind and it just won't work.
I have the same exact problem, using "react-native": "0.43.3".
If anyone could update this issue it would be grate, thanks!
from react-native-zip-archive.
from react-native-zip-archive.
Related Issues (20)
- Error install SSZipArchive HOT 2
- Android warning: "new NativeEventEmitter() was called with a non-null argument without the required addListener method"
- ld: library not found for -lRNZipArchive - iOS HOT 5
- Uncaught Exception in zip4j HOT 3
- Old SSZipArchive dependency in iOS podspec HOT 5
- Invariant Violation: `new NativeEventEmitter()` requires a non-null argument. | Expo HOT 2
- charset GBK or UTF-8 is no work in ios HOT 4
- skipping some files and folders in unarchiving HOT 3
- problem with dependencies
- Failed to extract file Found Zip Path Traversal Vulnerability
- Convert a single file (.txt / .pdf / .xls) to a zip file from a specific path. HOT 1
- Supplying an encoded URI containing %20 in IOS causes a 'failed to open zip file'
- Undefined is not an object on unzip() - Android HOT 1
- Error: Failed to extract file invalid END header HOT 1
- How to upload completly folder with subfolders? HOT 1
- [IOS] Crash app when zip or unzip on Xcode 15 HOT 2
- There are always 25 files in my link, but when using this component to extract, only 23 are left HOT 1
- Progress on Android from 0 to 1 HOT 1
- Unzip file with expo HOT 4
- Android unzip process slower than iOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-zip-archive.