2 library(archive): Access several archive formats
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog binding to libarchive
        • library(archive): Access several archive formats
          • archive_open/3
          • archive_open/4
          • archive_close/1
          • archive_property/2
          • archive_next_header/2
          • archive_open_entry/2
          • archive_set_header_property/2
          • archive_header_property/2
          • archive_extract/3
          • archive_entries/2
          • archive_data_stream/3
          • archive_create/3
          • archive_foldl/4
Availability::- use_module(library(archive)).(can be autoloaded)
Source[semidet]archive_next_header(+Handle, -Name)
Forward to the next entry of the archive for which Name unifies with the pathname of the entry. Fails silently if the end of the archive is reached before success. Name is typically specified if a single entry must be accessed and unbound otherwise. The following example opens a Prolog stream to a given archive entry. Note that Stream must be closed using close/1 and the archive must be closed using archive_close/1 after the data has been used. See also setup_call_cleanup/3.
open_archive_entry(ArchiveFile, EntryName, Stream) :-
    open(ArchiveFile, read, In, [type(binary)]),
    archive_open(In, Archive, [close_parent(true)]),
    archive_next_header(Archive, EntryName),
    archive_open_entry(Archive, Stream).
Errors
permission_error(next_header, archive, Handle) if a previously opened entry is not closed.