0

I need to get the content of archives and then I want to uncompress the selected one - but I dont want to uncompress the archives to know what's in it. I'd like to list and uncompress at least zip and rar, but (if that's possible) I don't want to be limited to only these two.

Can you advise good npm modules or other projects to achieve this?

Here's what I came up with:

  1. zip I found node-zip can only unzip files, but not list archive content.
  2. rar The best solution seems node-rar, but I can't install it on Windows.
  3. node-uncompress This does what it says: It's an "Command-line wrapper for uncompressing various file types." So there is again no possibility to list archive content.

Currently I try to get node-uncompress to list files and hopefully it must never run cross-platform.

simon-p-r
  • 3,623
  • 2
  • 20
  • 35
SUhrmann
  • 632
  • 1
  • 8
  • 26

1 Answers1

1

Solution:

I am now using 7zip with the node module node-7z instead of trying to get every archive working on its own. The corresponding site is: https://www.npmjs.com/package/node-7z

This library uses the OS independent archive manager 7zip. On Windows 7za is used. "7za.exe (a = alone) is a standalone version of 7-Zip". I've tested it on Windows and Ubuntu and it works great.

Update:

At Windows: Somehow I just got it working by adding 7za to the Path variables - not by adding 7za.exe to the "the same directory of your package.json file." like the description says.

Update 2:

On Windows 7za, that's referred in the node-7z post, cannot handle .rar-archives. So I'm using the "casual" 7-zip instead of 7za.exe. I just renamed the commanline 7z.exe to 7za.exe and added the 7-zip folder to the Path Variables.

SUhrmann
  • 632
  • 1
  • 8
  • 26
  • 1
    FYI - I rewrote node-7z in ES module syntax, added support for configurable 7z.exe / 7za.exe location and published as [es-7z](https://npmjs.com/package/es-7z) in case anyone needs to be able to adjust the path. – cchamberlain Jun 23 '16 at 22:44