uncompress.js icon indicating copy to clipboard operation
uncompress.js copied to clipboard

npm module?

Open btzr-io opened this issue 9 years ago • 8 comments

btzr-io avatar Sep 21 '16 01:09 btzr-io

I originally made this module to work in the browser. I have never tested it with Node. I assume it will work with minimal modifications, but I have no experience making NPM modules.

I would love if someone could help out in making a NPM module happen. Any help with that would be greatly appreciated.

workhorsy avatar Sep 22 '16 02:09 workhorsy

Load libunrar.js in a web-worker and call readRARContent function, read the source code for parameter/return value. Also read worker.js, index.html for usage example.

It seems like libunrar.js wont work because node js doesn't support web worker, but maybe I'm wrong:

Node integration doesn't work in web workers, and there is no plan to do. Workers in Chromium are implemented by starting a new thread, and Node is not thread safe. Back in past we had tried to add node integration to web workers in Atom, but it crashed too easily so we gave up on it.

btzr-io avatar Sep 22 '16 05:09 btzr-io

If you are in node.js environment then this is probably useless for you because you can call the native unrar utility/library https://github.com/wcchoi/libunrar-js#why

btzr-io avatar Sep 22 '16 05:09 btzr-io

Minimal modifications:

btzr-io avatar Sep 22 '16 07:09 btzr-io

Something like this package.json libunrar.js alternative: unrar utility/library (not sure if is the best alternative)

btzr-io avatar Sep 22 '16 08:09 btzr-io

The libunrar.js we use is just the official Rarlabs unrar compiled to JS using Emscripten. So it works the same, but uses much more RAM and CPU. So if you are on a system with unrar installed, that would be a much better thing to use.

workhorsy avatar Sep 22 '16 15:09 workhorsy

Also note. Our version of libunrar.js has been modified to work without a WebWorker. The original version at https://github.com/wcchoi/libunrar-js uses a WebWorker. So that should not be a problem.

workhorsy avatar Sep 22 '16 15:09 workhorsy

Ok, I just found this: unarchiver, supported file formats include Zip, Tar-GZip, Tar-BZip2, RAR and more, also there is a npm package: https://www.npmjs.com/package/unpack-all

btzr-io avatar Sep 22 '16 18:09 btzr-io