augustl / js-unzip Goto Github PK
View Code? Open in Web Editor NEWUnzip files with JavaScript
Unzip files with JavaScript
Good morning,
I make web application. I have small problem. User select zip file from your computer and i have blob from it. My code for load zip is:
var readerWorker = new FileReader() var fileWorker = fileForOpen.files[0] readerWorker.onload = function (e) { var text = e.target.result text = text.toString().substring(41) var zip = new JSUnzip(text) var isZip = zip.isZipFile() if (isZip) { zip.readEntries() for (var file in zip.entries) { var withoutCompression if (file.compressionMethod === 0) { withoutCompression = file.data } else if (file.compressionMethod === 8) { withoutCompression = JSInflate.inflate(file.data) } } } } readerWorker.readAsDataURL(fileWorker)
In the variable text is for example:
UEsDBAoAAAAAALKDfkLEb0P5GwAAABsAAAAIAAAAZGF0YS50eHRhYWFhYQpiYmJiCjI1CkdyYWZpawpjY2NjY2NQSwMECgAAAAAAwoN+QnOXrZQ4AAAAOAAAAAgAAABmb3RvLmpwZ3WrWopmoHv4In22rHuuEdJRjg3YQUABQCAAgAAAAD/3gAsAAAAAAUABQAAAgiMD5FnqwpSAQA4AUEsBAhQACgAAAAAAsoN+QsRvQ/kbAAAAGwAAAAgAAAAAAAAAAAAAAAAAAAAAAGRhdGEudHh0UEsBAhQACgAAAAAAwoN+QnOXrZQ4AAAAOAAAAAgAAAAAAAAAAAAAAAAAQQAAAGZvdG8uanBnUEsFBgAAAAACAAIAbAAAAJ8AAAAAAA==
If I debug it, I see in variable isZip value false. Why?
Hi,
Is there possible to unzip a cab(Cabinet) file with js-unzip? The cab file is produced from MS VisualStudio smartphone project and I just need to get a file in the cab. I got Error when reading Zip file: File is not a Zip file.
Thanks
simple use
when I run "unzipper.readEntries();"
got error "Uncaught File is using bit 3 trailing data descriptor. Not supported. "
what meaning?
The issue is that some distance codes need more then 8 extra distance bits, and the existing read_bits function didn't handle that case (it only appears to allow for extracting 8 bits). I changed the line that parses out the value to:
val = d.tag & (0xffff >> (16 - num));
and it seems to be decoding my stream correctly.
I am using this to decode a live stream so I don't have sample data readily available to submit with this report, although I could try to generate some.
BTW, I appreciate the readability of this code vs. most other deflate implementations that I looked at.
Tried updating js-unzip.js with the new release of Nov 6th and my page does not work anymore, the unzip process does not seem to ever end.
The page worked fine with the previous version of js-unzip, PROVIDED I ADDED THE "& 0xFF" JSUnzip.BigEndianBinaryStream.getByteAt
I tried debugging, but even after a relative long time (much longer that required for the older js-unzip.js to display the page) google chrome is still stuck in loops in js-unzip/js-inflate.
This is the page:
http://pgn4web.casaschi.net/zipped.html
This is the zipfile I'm trying to open:
http://pgn4web.casaschi.net/zipped.zip
Hi august.. I have a problem.. For some unexplained reason the unzipper misses an entry in my epub file.. It reads the mimetype and the META-INF dir just fine, but when it comes to the dir OEBPS it just skips it and thus js-epub fails.. I hope there is a logical explanation hope you can help
Regards
Jakob
Iit's not possible to read a ZIP archive with several PNG files
I have zipped one xml file and one .moc file. .moc is our project specific extension but actually content inside adhers to xml format.
In my application I get the url of this zip file hosted on network, I tried to use ajax call with GET to get the content from WEB url in blob object.
If I input this blob object for JSUnzip API and followed by that I am checking the number of entries.
If the ZIP file contains only xml file it is getting the entries properly but if mocf file is present in the zip it is not working.
Any specific reasons why few file formats not supported?
For a zip with xml file alone I got the entry properly but if I give that as input for inflate uncompressed = JSInflate.inflate(entry.data); (where entry = unzipper.entries[0]). I am getting uncompressed data as empty.
i.e. inflate is resulting empty data.
Please review and suggest your opinion.
Hello,
I'm working out with test/integration/index.html & test/integration/test.js
I don't know why but entries.lengh is always equal to 1, even if the zip contains multiples files.
Can you help?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.