Parameters & Returns
Parameters
sourcePath
String
zipFile
String
Returns
Quick Summary
Compresses a single file into a ZIP archive.
Takes a source file path and ZIP file path.
Returns 1 on success, 0 on failure (NULL parameters, file read error, or ZIP creation error).
Technical Exegesis...
Creates a ZIP archive containing a single file. Reads the entire source file into memory, creates a ZIP archive, and adds the file using MZ_DEFAULT_COMPRESSION. Returns 1 on success, 0 on failure (NULL parameters, file read error, or ZIP creation error).
Uses miniz library (mz_zip_writer). Extracts just the filename from sourcePath for the archive entry (strips directory path). The file is compressed and stored in the ZIP. Useful for compressing individual files for distribution or storage.