dfvfs
dfvfs copied to clipboard
Improve archive file support
Add Improve archive file support for:
- [ ] 7z
- [ ] AD1
- [ ] ARC
- [ ] ARJ
- [ ] CAB
- [ ] CPIO
- [ ] EWF-L01 and EWF-Lx01
- Requires: libewf/pyewf
- [ ] LZA
- [ ] RAR
- [ ] X-Ways Containers (is this an archive file?)
FYI, I have a fairly extensive support for archive extraction through a libarchive ctypes binding and 7zip subprocesses and the Python stdlib here: https://github.com/nexB/scancode-toolkit/tree/develop/src/extractcode It may or may not be useful to you and it may or give you some ideas.
@pombredanne thanks I'll give it a look
https://github.com/libarchive/libarchive The license is a bit messy, mainly BSD 2-clause, some BSD 3-clause, public domain.
Then there appear to be 3 different projects that provide Python bindings
- https://pypi.org/project/libarchive/ (GPL 2)
- https://pypi.org/project/libarchive-c/ (CC0)
- https://pypi.org/project/python-libarchive/ (BSD)
Fedora and Ubuntu ship with python3-libarchive-c unfortunately this is public domain, no FOSS license, so treat it as an optional dependency for now.
It support reading from file-like objects
f = open('syslog.zip', 'rb')
with libarchive.stream_reader(f) as r:
for e in r:
print(e)
Looks like a seekable_stream_reader was added very recently https://github.com/Changaco/python-libarchive-c/blame/master/libarchive/read.py#L142