Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_zip.h File Reference

Reading members out of a ZIP archive, to a file or into memory. More...

#include <stddef.h>
#include <stdint.h>
Include dependency graph for n_zip.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  N_ZIP_MEMBER
 What n_zip_find() says about a member. More...

Functions

int n_zip_extract (const char *path, const char *name, const char *out)
 write a member out to a file, checking its CRC-32
int n_zip_find (const char *path, const char *name, N_ZIP_MEMBER *member)
 find a member by its full name in an archive's central directory
int n_zip_find_ending (const char *path, const char *ending, char *name, size_t name_len)
 find the first member whose name ends with a given text, as a PyTorch checkpoint's "archive/data.pkl" whose folder name varies
int n_zip_read (const char *path, const char *name, size_t max_size, unsigned char **data, size_t *len)
 read a member into memory, checking its CRC-32

Detailed Description

Reading members out of a ZIP archive, to a file or into memory.

What a program needs to take one file out of an archive it downloaded: find the member by name in the central directory, and write it out, stored or deflated, inflated a piece at a time so a member of hundreds of megabytes needs no more memory than its buffers, its CRC-32 checked. Read only; no ZIP64 (a member or an archive over 4 GiB is refused), no encryption, no other compression method.

Author
Castagnier Mickael
Version
1.0
Date
28/09/2026

Definition in file n_zip.h.