ARCHIVE_WRITE_FILTER(3)
π 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_b64encodearchive_write_add_filter_by_namearchive_write_add_filter_bzip2archive_write_add_filter_compressarchive_write_add_filter_grziparchive_write_add_filter_gziparchive_write_add_filter_lrziparchive_write_add_filter_lz4archive_write_add_filter_lziparchive_write_add_filter_lzmaarchive_write_add_filter_lzoparchive_write_add_filter_nonearchive_write_add_filter_programarchive_write_add_filter_uuencodearchive_write_add_filter_xzarchive_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:
tar(1)archive_write(3)archive_write_format(3)archive_write_set_options(3)libarchive(3)cpio(5)mtree(5)tar(5)
β¨ 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
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2003-2011 Tim Kientzle
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms