workhorsy / uncompress.js Goto Github PK
View Code? Open in Web Editor NEWUncompress ZIP, RAR, and TAR files with pure JavaScript
Home Page: http://workhorsy.github.io/uncompress.js/examples
License: MIT License
Uncompress ZIP, RAR, and TAR files with pure JavaScript
Home Page: http://workhorsy.github.io/uncompress.js/examples
License: MIT License
Change loadArchiveFormats to use a callback, to prevent users from calling functions, before the library is ready.
// Change this
loadArchiveFormats(['rar', 'zip', 'tar']);
archiveOpenFile(file, function(archive, err) {
// read archive here
});
// To this
loadArchiveFormats(['rar', 'zip', 'tar'], function() {
archiveOpenFile(file, function(archive, err) {
// read archive here
});
});
Sorry if I'm missing the obvious - but are there any docs?
rt
I'm building a drag/drop reader for CBR/CBZ files. I'm using this code to dynamically switch between working w/ a rar or zip based on the extension (and yeah, the check is a bit lame):
function handleFile(file) {
console.log('try to parse '+file.name);
let fileReader = new FileReader();
let ext = ".zip";
if(file.name.indexOf(".cbr") >= 0) {
//above should check END of name, not anywhere
ext = ".rar";
}
console.log('This is a '+ext);
fileReader.onload = function() {
console.log('onload');
let array_buffer = this.result;
console.log(array_buffer);
let archive = archiveOpenArrayBuffer("example_rar_5"+ext, null, array_buffer);
if (archive) {
console.info('Uncompressing ' + archive.archive_type + ' ...');
console.dir(archive);
//onArchiveLoaded(archive);
} else {
//console.error(err);
}
}
fileReader.readAsArrayBuffer(file);
I can confirm that dropping a cbz file works fine, but dropping a cbr gives me: Error: The archive type is unknown.
Any idea why?
how to use this on Android web browser??
or libunrar-js (how to build wasm version???)
rt
It works,
but why?
It would be nice if it could support self-exe rar archives.
Is there a way to extract an archive to a local directory using node.js?
Hi, is there a way to get the file loaded and extracted from a URL rather than from an INPUT field
Example:
var file = "https://mydomain.com/files/family_trip.cbr";
Is there a way to open rar with password?
If it is based on libunrar it should have option, but I can't figure out if it is possible.
I'm not sure if this is possible or useful,
but would be nice to keep track of the decompression progress.
The function currentScriptPath() is so skillfully method to get path. But i can't get the correct path on my device. I find why it not work correctly.
the problem in uncompress.js line 39 : "
line = stack.split('(')[1].split(')')[0];
"
because my project path include parenthesis mark, so that function can not cacth the correct path.
and I fix this bug with use RegEx like this : "
line = stack.split(/[\s][(]/)[1].split(/[)][\n]/)[0];
โ
let and const are supported in everything now. Including IE11. So we should replace var with let and const.
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.