Archive.Nif (Archive v0.2.0)

Proceed With Caution

The Archive.Nif module contains the functions that directly interact with libarchive. It is generally discouraged to interact with this library directly. If you find you need functionality not supported in the higher-level APIs, consider opening an issue first if the feature would be generally applicable or desireable.

Archive.Nif provides direct Elixir bindings to the libarchive C API. Most of the functions in this module are 1-to-1 mappings to the C API equivalent functions.

These functions work directly with references, rather than Archive or Archive.Entry structs.

As long as you use the ArchiveResource and ArchiveEntryResource reference types, they will be managed and garbage-collected by this module once created.

Most functions in this module may raise ErlangError on failure. You should invoke most of these functions using Archive.Nif.safe_call/2 to catch the errors and return them as :ok or an {:error, reason} tuple

Summary

Functions

Link to this function

archive_clear_error(arg1)

@spec archive_clear_error(reference()) :: :ok
Link to this function

archive_entry_new()

@spec archive_entry_new() :: reference()
Link to this function

archive_entry_pathname(arg1)

@spec archive_entry_pathname(reference()) :: binary()
Link to this function

archive_entry_size(arg1)

@spec archive_entry_size(reference()) ::
  -9_223_372_036_854_775_808..9_223_372_036_854_775_807
Link to this function

archive_entry_stat(arg1)

@spec archive_entry_stat(reference()) :: term()
Link to this function

archive_error_string(arg1)

@spec archive_error_string(reference()) :: binary()
Link to this function

archive_file_count(arg1)

@spec archive_file_count(reference()) :: -2_147_483_648..2_147_483_647
Link to this function

archive_format(arg1)

@spec archive_format(reference()) :: -2_147_483_648..2_147_483_647
Link to this function

archive_format_name(arg1)

@spec archive_format_name(reference()) :: binary()
Link to this function

archive_read_close(arg1)

@spec archive_read_close(reference()) :: :ok
Link to this function

archive_read_data(arg1, arg2)

@spec archive_read_data(reference(), 0..18_446_744_073_709_551_615) :: binary()
Link to this function

archive_read_format_capabilities(arg1)

@spec archive_read_format_capabilities(reference()) :: -2_147_483_648..2_147_483_647
Link to this function

archive_read_new()

@spec archive_read_new() :: reference()
Link to this function

archive_read_next_header(arg1, arg2)

@spec archive_read_next_header(reference(), reference()) :: :ok
Link to this function

archive_read_open_filename(arg1, arg2, arg3)

@spec archive_read_open_filename(
  reference(),
  [byte()] | binary(),
  0..18_446_744_073_709_551_615
) :: :ok
Link to this function

archive_read_open_memory(arg1, arg2)

@spec archive_read_open_memory(reference(), [byte()] | binary()) :: :ok
Link to this function

archive_read_support_compression_all(arg1)

@spec archive_read_support_compression_all(reference()) :: :ok
Link to this function

archive_read_support_filter_all(arg1)

@spec archive_read_support_filter_all(reference()) :: :ok
Link to this function

archive_read_support_filter_by_code(arg1, arg2)

@spec archive_read_support_filter_by_code(reference(), -2_147_483_648..2_147_483_647) ::
  :ok
Link to this function

archive_read_support_format_all(arg1)

@spec archive_read_support_format_all(reference()) :: :ok
Link to this function

archive_read_support_format_by_code(arg1, arg2)

@spec archive_read_support_format_by_code(reference(), -2_147_483_648..2_147_483_647) ::
  :ok
Link to this function

archive_read_support_format_raw(arg1)

@spec archive_read_support_format_raw(reference()) :: :ok
Link to this function

archiveFilterToAtom(arg1)

@spec archiveFilterToAtom(-2_147_483_648..2_147_483_647) ::
  :zstd
  | :xz
  | :uu
  | :rpm
  | :program
  | :none
  | :lzop
  | :lzma
  | :lzip
  | :lz4
  | :lrzip
  | :gzip
  | :grzip
  | :compress
  | :bzip2
Link to this function

archiveFilterToInt(arg1)

@spec archiveFilterToInt(
  :zstd
  | :xz
  | :uu
  | :rpm
  | :program
  | :none
  | :lzop
  | :lzma
  | :lzip
  | :lz4
  | :lrzip
  | :gzip
  | :grzip
  | :compress
  | :bzip2
  | 0..14
) :: -2_147_483_648..2_147_483_647
Link to this function

archiveFormatToAtom(arg1)

@spec archiveFormatToAtom(-2_147_483_648..2_147_483_647) ::
  :zip
  | :xar
  | :warc
  | :tar_ustar
  | :tar_pax_restricted
  | :tar_pax_interchange
  | :tar_gnutar
  | :tar
  | :shar_dump
  | :shar_base
  | :shar
  | :sevenz
  | :raw
  | :rar_v5
  | :rar
  | :mtree
  | :lha
  | :iso9660_rockridge
  | :iso9660
  | :empty
  | :cpio_svr4_nocrc
  | :cpio_svr4_crc
  | :cpio_pwb
  | :cpio_posix
  | :cpio_bin_le
  | :cpio_bin_be
  | :cpio_afio_large
  | :cpio
  | :cab
  | :base_mask
  | :ar_gnu
  | :ar_bsd
  | :ar
Link to this function

archiveFormatToInt(arg1)

@spec archiveFormatToInt(
  :zip
  | :xar
  | :warc
  | :tar_ustar
  | :tar_pax_restricted
  | :tar_pax_interchange
  | :tar_gnutar
  | :tar
  | :shar_dump
  | :shar_base
  | :shar
  | :sevenz
  | :raw
  | :rar_v5
  | :rar
  | :mtree
  | :lha
  | :iso9660_rockridge
  | :iso9660
  | :empty
  | :cpio_svr4_nocrc
  | :cpio_svr4_crc
  | :cpio_pwb
  | :cpio_posix
  | :cpio_bin_le
  | :cpio_bin_be
  | :cpio_afio_large
  | :cpio
  | :cab
  | :base_mask
  | :ar_gnu
  | :ar_bsd
  | :ar
  | 16_711_680
  | 1_048_576
  | 983_040
  | 917_504
  | 851_968
  | 786_432
  | 720_896
  | 655_360
  | 589_824
  | 524_288
  | 458_752..458_754
  | 393_216
  | 327_680
  | 262_144..262_145
  | 196_608..196_612
  | 131_072..131_074
  | 65536..65543
) :: -2_147_483_648..2_147_483_647
Link to this function

get_error_string(ref)

Link to this function

safe_call(fun, ref \\ nil)