uncompress.js
uncompress.js copied to clipboard
npm module?
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.
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.
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
Minimal modifications:
- Add package.json
- function loadScript(url) needs to be replaced by require()
- function currentScriptPath() needs to be replaced by __dirname
- find libunrar.js alternative (Just in case)
Something like this package.json libunrar.js alternative: unrar utility/library (not sure if is the best alternative)
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.
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.
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