2 releases
Uses old Rust 2015
0.2.3 | Dec 27, 2018 |
---|---|
0.2.2 | Dec 12, 2018 |
#20 in #gz
Used in 2 crates
22KB
383 lines
Archive-lp-rs
Rust library for working with archives, designed for Lovepack. Takes much of the middle work for accessing files inside a library.
Functionality
Knows what to do for the following files
- *.zip
- *.tar.gz
- *.tar.xz
Can do the following
- extract archive to a directory: archive_lp::extract_to()
- extract root of an archive to a directory: archive_lp::extract_root_to()
- check if a file is in an archive: archive_lp::contains_file()
Optional Features
- indicate : uses
indicatif
to show a progress spinner with some details during extraction.
lib.rs
:
Checks if a certain file is in an archive. Extracts the archive to the destination folder.
Checks if the archive and folder exists and then extracts the archive into the folder. If the destination folder doesn't exist then it attempts to create it. Extracts the root of the archive to the destination folder.
Checks if the archive and folder exists and then extracts the archive into the folder. If the destination folder doesn't exist then it attempts to create it.
The 'root' of the folder is where all the files are located. Sometimes the contents of archives are nested in multiple folders before the actual data.
This function looks at each actual file in the archive and finds the file with the shortest absolute path in the archive, and assumes that is the root of the archive, and then extracts that file to the root of the destination folder. gets the second extenison, so aa.b.c then it returns b
Dependencies
~5–16MB
~207K SLoC