ARCHIVE_WRITE_FILTER(3)

πŸ“¦
version 3.8.7 Β· 3 versions
, in centos-stream 10, debian trixie, fedora 43, fedora 44, freebsd 14.5, freebsd 15.1, opensuse-leap 16.0, ubuntu questing, ubuntu resolute

πŸ’… ARCHIVE_WRITE_FILTER β€” ok bestie, let's talk output filters ✨

So this is a page from the Library Functions Manual, section 3 β€” it's the libarchive girlies' guide to slapping a filter on your output stream. Library? Streaming Archive Library (libarchive, -larchive). Periodt. πŸŽ€


✨ NAME ✨

Like, all of these are functions that enable output filters, mwah:

  • archive_write_add_filter_b64encode
  • archive_write_add_filter_by_name
  • archive_write_add_filter_bzip2
  • archive_write_add_filter_compress
  • archive_write_add_filter_grzip
  • archive_write_add_filter_gzip
  • archive_write_add_filter_lrzip
  • archive_write_add_filter_lz4
  • archive_write_add_filter_lzip
  • archive_write_add_filter_lzma
  • archive_write_add_filter_lzop
  • archive_write_add_filter_none
  • archive_write_add_filter_program
  • archive_write_add_filter_uuencode
  • archive_write_add_filter_xz
  • archive_write_add_filter_zstd

that's the whole squad, no gatekeeping πŸ’œ


πŸ¦‹ SYNOPSIS πŸ¦‹

First, the include β€” do not skip her:

#include <archive.h>

Then, the lineup, exactly as written:

int
archive_write_add_filter_b64encode(struct archive *);

int
archive_write_add_filter_bzip2(struct archive *);

int
archive_write_add_filter_compress(struct archive *);

int
archive_write_add_filter_grzip(struct archive *);

int
archive_write_add_filter_gzip(struct archive *);

int
archive_write_add_filter_lrzip(struct archive *);

int
archive_write_add_filter_lz4(struct archive *);

int
archive_write_add_filter_lzip(struct archive *);

int
archive_write_add_filter_lzma(struct archive *);

int
archive_write_add_filter_lzop(struct archive *);

int
archive_write_add_filter_none(struct archive *);

int
archive_write_add_filter_program(struct archive *, const char * cmd);

int
archive_write_add_filter_uuencode(struct archive *);

int
archive_write_add_filter_xz(struct archive *);

int
archive_write_add_filter_zstd(struct archive *);

(yes the cmd one takes an extra string arg, she's special like that 😌)


🌸 DESCRIPTION 🌸

Okay so here's the vibe check on what each of these actually does:

🫢 the compression girlies

  • archive_write_add_filter_bzip2(), archive_write_add_filter_compress(), archive_write_add_filter_grzip(), archive_write_add_filter_gzip(), archive_write_add_filter_lrzip(), archive_write_add_filter_lz4(), archive_write_add_filter_lzip(), archive_write_add_filter_lzma(), archive_write_add_filter_lzop(), archive_write_add_filter_xz(), archive_write_add_filter_zstd() β€” the resulting archive will be compressed as specified. And ngl, the compressed output is always properly blocked. πŸ”₯

πŸ’– the encoding girlies

  • archive_write_add_filter_b64encode(), archive_write_add_filter_uuencode() β€” the output will be encoded as specified. The encoded output is always properly blocked. slay and block πŸ’…

πŸ™ˆ the "why is this here" one

  • archive_write_add_filter_none() β€” bestie, this is never necessary. It is provided only for backwards compatibility. Literally just vibes and legacy code. πŸ’€

🧚 the one with main character energy

  • archive_write_add_filter_program() β€” the archive will be fed into the specified compression program. The output of that program is blocked and written to the client write callbacks. iykyk πŸ¦‹

⭐ RETURN VALUES ⭐

These functions return ARCHIVE_OK on success, or ARCHIVE_FATAL. That's the whole mood. success or chaos, no in between 😭


πŸŽ€ ERRORS πŸŽ€

When it goes sideways, detailed error codes and textual descriptions are available from the archive_errno() and archive_error_string() functions. go read them, they'll tell you everything you need to know fr fr


🌈 SEE ALSO 🌈

Go be nosy, bestie:


✨ and that's the page, you ate, you understood filters, go compress something πŸ’–

sign-off time: this cutie came from Debian, dated August 14, 2014, and lives in section 3 of the manual. mwah, bye 🫢

πŸ“¦ where this page comes from