libunpacker 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- libunpacker-0.1.0/LICENSE +21 -0
- libunpacker-0.1.0/PKG-INFO +62 -0
- libunpacker-0.1.0/README.md +48 -0
- libunpacker-0.1.0/libunpacker.egg-info/PKG-INFO +62 -0
- libunpacker-0.1.0/libunpacker.egg-info/SOURCES.txt +8 -0
- libunpacker-0.1.0/libunpacker.egg-info/dependency_links.txt +1 -0
- libunpacker-0.1.0/libunpacker.egg-info/requires.txt +1 -0
- libunpacker-0.1.0/libunpacker.egg-info/top_level.txt +1 -0
- libunpacker-0.1.0/pyproject.toml +25 -0
- libunpacker-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Msmastr74
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: libunpacker
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A multi-format archive unpacking utility supporting deep recursion.
|
|
5
|
+
Author-email: Msmastr74 <zontaniguitars@gmail.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: rarfile
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# libunpacker
|
|
16
|
+
A multi-format archive unpacking utility supporting deep recursion.
|
|
17
|
+
|
|
18
|
+
## How to use it
|
|
19
|
+
The simplest way to use it that can be used in almost any use case, is simply `libunpacker.unpack(input_file_name, output_file_name)`, this will take `input_file_name` and write it's uncompressed contents to `output_file_name`. However with multi-file archives, `output_file_name` must be a directory (ending with a /, this is mandatory)
|
|
20
|
+
### Operators
|
|
21
|
+
A fun little thing I added to this is operators, these allow you to have special functionality without doing some crazy weird tricks and workarounds so here they are:
|
|
22
|
+
#### input (arg 1)
|
|
23
|
+
- `//data:<raw file data>`: rather than reading a file for the data, it takes it directly from your input!
|
|
24
|
+
|
|
25
|
+
#### output (arg 2)
|
|
26
|
+
- `//return`: instead of writing the uncompressed file data, it returns it
|
|
27
|
+
- `//overwrite:<file path>`: by default, it uses "xb" instead of "wb" for file writing, this makes it use "wb" (cannot be used on directories)
|
|
28
|
+
- `//autocreate:<directory path>`: by default, it doesn't write to directories that don't exist, this makes it create directories that don't exist and continue on like normal
|
|
29
|
+
|
|
30
|
+
## The unpackers class
|
|
31
|
+
This is what actually does the unpacking, the unpack function just handles the reading recursion and writing, although all of these functions require raw byte data as input and always return a dictionary containing the extracted data
|
|
32
|
+
(fun little quirk I gotta include here, unpackers.xz() can handle LZMA1 compression, but unpack() can't)
|
|
33
|
+
|
|
34
|
+
yeah that's pretty much everything you need to know to use this thing, here's my testing script that demonstrates how it's actually used and all the supported formats for all you visual learners out there:
|
|
35
|
+
```python
|
|
36
|
+
up.unpack("libunpacker_test_zip.zip", "ziptest/")
|
|
37
|
+
up.unpack("libunpacker_test_gzip.txt.gz", "gztest.txt")
|
|
38
|
+
up.unpack("libunpacker_test_bz2.txt.bz2", "bz2test.txt")
|
|
39
|
+
up.unpack("libunpacker_test_xz.txt.xz", "xztest.txt")
|
|
40
|
+
up.unpack("libunpacker_test_7z.7z", "7ztest/")
|
|
41
|
+
up.unpack("libunpacker_test_tar.tar", "tartest/")
|
|
42
|
+
up.unpack("libunpacker_test_rar.rar", "rartest/")
|
|
43
|
+
up.unpack("libunpacker_test_targz.tar.gz", "tgztest/")
|
|
44
|
+
up.unpack("libunpacker_test_big_one.tar.zip.7z.rar.gz.bz2.xz", "bigtest/")
|
|
45
|
+
up.unpack("libunpacker_test_big_one_disguised", "bigtest2/")
|
|
46
|
+
with open("libunpacker_test_lzma.txt.lzma", "rb") as f:
|
|
47
|
+
lzma_file_data = up.unpackers.xz(f.read())
|
|
48
|
+
with open("lzmatest.txt", "wb") as f:
|
|
49
|
+
f.write(lzma_file_data["file"])
|
|
50
|
+
# monofile testing
|
|
51
|
+
up.unpack("libunpacker_test_zip_mono.txt.zip", "zipmonotest.txt")
|
|
52
|
+
up.unpack("libunpacker_test_7z_mono.txt.7z", "7zmonotest.txt")
|
|
53
|
+
up.unpack("libunpacker_test_tar_mono.txt.tar", "tarmonotest.txt")
|
|
54
|
+
up.unpack("libunpacker_test_rar_mono.txt.rar", "rarmonotest.txt")
|
|
55
|
+
return_data = up.unpack("libunpacker_test_xz.txt.xz", "//return")
|
|
56
|
+
print(return_data)
|
|
57
|
+
with open("libunpacker_test_xz.txt.xz", "rb") as f:
|
|
58
|
+
up.unpack(b"//data:" + f.read(), "datainputtest.txt")
|
|
59
|
+
up.unpack("libunpacker_test_xz.txt.xz", "//overwrite:datainputtest.txt")
|
|
60
|
+
up.unpack("libunpacker_test_zip.zip", "//autocreate:newdir/")
|
|
61
|
+
```
|
|
62
|
+
oh and if you're debugging, `libunpacker.verbose == True` makes it print out some runtime debugging info, it was useful for me
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# libunpacker
|
|
2
|
+
A multi-format archive unpacking utility supporting deep recursion.
|
|
3
|
+
|
|
4
|
+
## How to use it
|
|
5
|
+
The simplest way to use it that can be used in almost any use case, is simply `libunpacker.unpack(input_file_name, output_file_name)`, this will take `input_file_name` and write it's uncompressed contents to `output_file_name`. However with multi-file archives, `output_file_name` must be a directory (ending with a /, this is mandatory)
|
|
6
|
+
### Operators
|
|
7
|
+
A fun little thing I added to this is operators, these allow you to have special functionality without doing some crazy weird tricks and workarounds so here they are:
|
|
8
|
+
#### input (arg 1)
|
|
9
|
+
- `//data:<raw file data>`: rather than reading a file for the data, it takes it directly from your input!
|
|
10
|
+
|
|
11
|
+
#### output (arg 2)
|
|
12
|
+
- `//return`: instead of writing the uncompressed file data, it returns it
|
|
13
|
+
- `//overwrite:<file path>`: by default, it uses "xb" instead of "wb" for file writing, this makes it use "wb" (cannot be used on directories)
|
|
14
|
+
- `//autocreate:<directory path>`: by default, it doesn't write to directories that don't exist, this makes it create directories that don't exist and continue on like normal
|
|
15
|
+
|
|
16
|
+
## The unpackers class
|
|
17
|
+
This is what actually does the unpacking, the unpack function just handles the reading recursion and writing, although all of these functions require raw byte data as input and always return a dictionary containing the extracted data
|
|
18
|
+
(fun little quirk I gotta include here, unpackers.xz() can handle LZMA1 compression, but unpack() can't)
|
|
19
|
+
|
|
20
|
+
yeah that's pretty much everything you need to know to use this thing, here's my testing script that demonstrates how it's actually used and all the supported formats for all you visual learners out there:
|
|
21
|
+
```python
|
|
22
|
+
up.unpack("libunpacker_test_zip.zip", "ziptest/")
|
|
23
|
+
up.unpack("libunpacker_test_gzip.txt.gz", "gztest.txt")
|
|
24
|
+
up.unpack("libunpacker_test_bz2.txt.bz2", "bz2test.txt")
|
|
25
|
+
up.unpack("libunpacker_test_xz.txt.xz", "xztest.txt")
|
|
26
|
+
up.unpack("libunpacker_test_7z.7z", "7ztest/")
|
|
27
|
+
up.unpack("libunpacker_test_tar.tar", "tartest/")
|
|
28
|
+
up.unpack("libunpacker_test_rar.rar", "rartest/")
|
|
29
|
+
up.unpack("libunpacker_test_targz.tar.gz", "tgztest/")
|
|
30
|
+
up.unpack("libunpacker_test_big_one.tar.zip.7z.rar.gz.bz2.xz", "bigtest/")
|
|
31
|
+
up.unpack("libunpacker_test_big_one_disguised", "bigtest2/")
|
|
32
|
+
with open("libunpacker_test_lzma.txt.lzma", "rb") as f:
|
|
33
|
+
lzma_file_data = up.unpackers.xz(f.read())
|
|
34
|
+
with open("lzmatest.txt", "wb") as f:
|
|
35
|
+
f.write(lzma_file_data["file"])
|
|
36
|
+
# monofile testing
|
|
37
|
+
up.unpack("libunpacker_test_zip_mono.txt.zip", "zipmonotest.txt")
|
|
38
|
+
up.unpack("libunpacker_test_7z_mono.txt.7z", "7zmonotest.txt")
|
|
39
|
+
up.unpack("libunpacker_test_tar_mono.txt.tar", "tarmonotest.txt")
|
|
40
|
+
up.unpack("libunpacker_test_rar_mono.txt.rar", "rarmonotest.txt")
|
|
41
|
+
return_data = up.unpack("libunpacker_test_xz.txt.xz", "//return")
|
|
42
|
+
print(return_data)
|
|
43
|
+
with open("libunpacker_test_xz.txt.xz", "rb") as f:
|
|
44
|
+
up.unpack(b"//data:" + f.read(), "datainputtest.txt")
|
|
45
|
+
up.unpack("libunpacker_test_xz.txt.xz", "//overwrite:datainputtest.txt")
|
|
46
|
+
up.unpack("libunpacker_test_zip.zip", "//autocreate:newdir/")
|
|
47
|
+
```
|
|
48
|
+
oh and if you're debugging, `libunpacker.verbose == True` makes it print out some runtime debugging info, it was useful for me
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: libunpacker
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A multi-format archive unpacking utility supporting deep recursion.
|
|
5
|
+
Author-email: Msmastr74 <zontaniguitars@gmail.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: rarfile
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# libunpacker
|
|
16
|
+
A multi-format archive unpacking utility supporting deep recursion.
|
|
17
|
+
|
|
18
|
+
## How to use it
|
|
19
|
+
The simplest way to use it that can be used in almost any use case, is simply `libunpacker.unpack(input_file_name, output_file_name)`, this will take `input_file_name` and write it's uncompressed contents to `output_file_name`. However with multi-file archives, `output_file_name` must be a directory (ending with a /, this is mandatory)
|
|
20
|
+
### Operators
|
|
21
|
+
A fun little thing I added to this is operators, these allow you to have special functionality without doing some crazy weird tricks and workarounds so here they are:
|
|
22
|
+
#### input (arg 1)
|
|
23
|
+
- `//data:<raw file data>`: rather than reading a file for the data, it takes it directly from your input!
|
|
24
|
+
|
|
25
|
+
#### output (arg 2)
|
|
26
|
+
- `//return`: instead of writing the uncompressed file data, it returns it
|
|
27
|
+
- `//overwrite:<file path>`: by default, it uses "xb" instead of "wb" for file writing, this makes it use "wb" (cannot be used on directories)
|
|
28
|
+
- `//autocreate:<directory path>`: by default, it doesn't write to directories that don't exist, this makes it create directories that don't exist and continue on like normal
|
|
29
|
+
|
|
30
|
+
## The unpackers class
|
|
31
|
+
This is what actually does the unpacking, the unpack function just handles the reading recursion and writing, although all of these functions require raw byte data as input and always return a dictionary containing the extracted data
|
|
32
|
+
(fun little quirk I gotta include here, unpackers.xz() can handle LZMA1 compression, but unpack() can't)
|
|
33
|
+
|
|
34
|
+
yeah that's pretty much everything you need to know to use this thing, here's my testing script that demonstrates how it's actually used and all the supported formats for all you visual learners out there:
|
|
35
|
+
```python
|
|
36
|
+
up.unpack("libunpacker_test_zip.zip", "ziptest/")
|
|
37
|
+
up.unpack("libunpacker_test_gzip.txt.gz", "gztest.txt")
|
|
38
|
+
up.unpack("libunpacker_test_bz2.txt.bz2", "bz2test.txt")
|
|
39
|
+
up.unpack("libunpacker_test_xz.txt.xz", "xztest.txt")
|
|
40
|
+
up.unpack("libunpacker_test_7z.7z", "7ztest/")
|
|
41
|
+
up.unpack("libunpacker_test_tar.tar", "tartest/")
|
|
42
|
+
up.unpack("libunpacker_test_rar.rar", "rartest/")
|
|
43
|
+
up.unpack("libunpacker_test_targz.tar.gz", "tgztest/")
|
|
44
|
+
up.unpack("libunpacker_test_big_one.tar.zip.7z.rar.gz.bz2.xz", "bigtest/")
|
|
45
|
+
up.unpack("libunpacker_test_big_one_disguised", "bigtest2/")
|
|
46
|
+
with open("libunpacker_test_lzma.txt.lzma", "rb") as f:
|
|
47
|
+
lzma_file_data = up.unpackers.xz(f.read())
|
|
48
|
+
with open("lzmatest.txt", "wb") as f:
|
|
49
|
+
f.write(lzma_file_data["file"])
|
|
50
|
+
# monofile testing
|
|
51
|
+
up.unpack("libunpacker_test_zip_mono.txt.zip", "zipmonotest.txt")
|
|
52
|
+
up.unpack("libunpacker_test_7z_mono.txt.7z", "7zmonotest.txt")
|
|
53
|
+
up.unpack("libunpacker_test_tar_mono.txt.tar", "tarmonotest.txt")
|
|
54
|
+
up.unpack("libunpacker_test_rar_mono.txt.rar", "rarmonotest.txt")
|
|
55
|
+
return_data = up.unpack("libunpacker_test_xz.txt.xz", "//return")
|
|
56
|
+
print(return_data)
|
|
57
|
+
with open("libunpacker_test_xz.txt.xz", "rb") as f:
|
|
58
|
+
up.unpack(b"//data:" + f.read(), "datainputtest.txt")
|
|
59
|
+
up.unpack("libunpacker_test_xz.txt.xz", "//overwrite:datainputtest.txt")
|
|
60
|
+
up.unpack("libunpacker_test_zip.zip", "//autocreate:newdir/")
|
|
61
|
+
```
|
|
62
|
+
oh and if you're debugging, `libunpacker.verbose == True` makes it print out some runtime debugging info, it was useful for me
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rarfile
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
libunpacker
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "libunpacker"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Msmastr74", email="zontaniguitars@gmail.com" }
|
|
10
|
+
]
|
|
11
|
+
description = "A multi-format archive unpacking utility supporting deep recursion."
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.8"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"rarfile",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[tool.setuptools]
|
|
24
|
+
py-modules = ["libunpacker"]
|
|
25
|
+
|