onikienko/7zip-min

Feature request: ability to extract single file

Opened this issue · 1 comments

I would love an option to extract a single file:

_7z.unpackSingle('some_file.7z', 'file_in_7z.txt', '/home', (err) => {
  // /home/file_in_7z.txt exists
});

I think something like this should be possible with:

7za x some_file.7z -y file_in_7z.txt

Really what I want is the ability to also specify its final location, including filename, but I don't think 7za supports something like this:

_7z.unpackSingle('some_file.7z', 'file_in_7z.txt', '/home/some_other_filename.txt', (err) => {
  // /home/some_other_filename.txt exists
});

Initially, I designed this package as a minimal 7z wrapper. Even the name tells - 7zip-min (minimal). Just pack and unpack 7z archives to avoid unreadable strings like 'a', 'path/to/archive.7z', 'path/to/dir/or/file'. With the ability to deal with 7z via cmd if it is required.
Later @aqblanco contributed the list method...
But I still want to keep the package minimal. So not sure about unpackSingle but I will investigate.