ZIP_SOURCE(5)
π ZIP_SOURCE(5) π
okay bestie, welcome to the file formats manual β¨ this is zip_source(5), and it's literally the glow-up your data needs before it goes into a zip archive π
π LIBRARY
libzip (-lzip) β that's the one, that's the girlies π
β¨ SYNOPSIS β¨
#include <zip.h>
zip_source_t *source;
π¦ DESCRIPTION π¦
So. A zip_source_t is a data source β or a destination, when you're using it for writing. no cap. libzip(3) uses it to add or replace the contents of a file inside a zip archive. And if your source supports seeking? bestie it can also be used to open zip archives from. it's giving multitasking π
Where can the data come from, you ask? obsessed that you asked π
- a file on disk β via
zip_source_file(3),zip_source_file_create(3),zip_source_filep(3), orzip_source_filep_create(3) - memory β via
zip_source_buffer(3),zip_source_buffer_create(3),zip_source_buffer_fragment(3), orzip_source_buffer_fragment_create(3) - a file inside an archive β via
zip_source_zip(3) - or whatever a callback function hands you β via
zip_source_function(3)orzip_source_function_create(3)
and if you only want part of that data? zip_source_window(3) or zip_source_window_create(3) can restrict access to a chunk of the contained data. slice it, bestie βοΈ
It can also act as a filter, processing the data handed over by an underlying zip_source_t β like, say, to compress it or compute a checksum. those get created with zip_source_layered(3) or zip_source_layered_create(3). layering? iconic. π
Sources get freed with zip_source_free(3). periodt.
π«Ά Sources must support reading, and can optionally support seeking and writing.
zip_source_t is reference counted, and it's created with a reference count of 1. now listen closely because this part matters fr fr:
zip_open_from_source(3),zip_file_add(3), andzip_file_replace(3)will take ownership of the source you pass them β meaning they decrement the reference count when they're done using it. so you only need to callzip_source_free(3)when those functions return an error.- The underlying data (file or buffer) must remain valid until the archive is closed. do not let it wander off π
- Use
zip_source_keep(3)to bump the reference count up β for example if you need the source afterzip_close(3).
π SEE ALSO
libzip(3), zip_source_buffer(3), zip_source_file(3), zip_source_filep(3), zip_source_free(3), zip_source_function(3), zip_source_keep(3), zip_source_window(3), zip_source_zip(3)
π AUTHORS
Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at> β the icons who wrote this π«Ά
and that's the whole page, bestie!! this one came from the Debian build, dated May 5, 2025 π go forth and source your zips responsibly, mwah πβ¨π¦
π¦ where this page comes from
- arch rolling: libzip 1.11.4-1 Β· BSD
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- nixpkgs unstable: libzip 1.11.4
- ubuntu resolute: libzip-dev 1.11.4-2 Β· BSD-3-Clause
- ubuntu stonking: libzip-dev 1.11.4-2build1 Β· BSD-3-Clause
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms