Hi,
As part of my
work with pharo-cig
I am releasing a new pharo library binding. This time for libarchive,
a multi-format archive and compression library: pharo-archive.
You can read and write any zip file:
"list contents of a file"
| fileRef arc archive paths entryHolder entry |
arc := LibArchive uniqueInstance.
fileRef := '/path/to/file.zip' asFileReference.
fileRef exists
ifFalse: [ self error: 'File ', fileRef fullName, ' not found.' ].
archive := arc read_new.
arc read_support_filter_all: archive.
arc read_support_format_all: archive.
arc
read_open_filenameArg1: archive
_filename: fileRef fullName
_block_size: 10240.
paths := OrderedCollection new.
entryHolder := ArchiveEntry newValueHolder.
[ (arc read_next_headerArg1: archive arg2: entryHolder) = 0 ]
whileTrue: [
entry := entryHolder value.
paths add: (arc entry_pathname: entry).
arc read_data_skip: archive.
].
arc read_free: archive.
paths inspect
Esteban