Compresses a single file into a password-protected ZIP archive.
Takes a source file path, ZIP file path, and password.
Returns 1 on success, 0 on failure (NULL parameters, file read error, or ZIP creation error).
File IO
Parameters & Returns
Parameters
sourcePathString
zipFileString
passwordString
Returns
Int
Quick Summary
Compresses a single file into a password-protected ZIP archive.
Takes a source file path, ZIP file path, and password.
Returns 1 on success, 0 on failure (NULL parameters, file read error, or ZIP creation error).
Technical Exegesis...
Creates a password-protected ZIP archive containing a single file. Reads the entire source file into memory, creates a ZIP archive, and adds the file with password encryption 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_add_mem_ex_v2) for password protection. Extracts just the filename from sourcePath for the archive entry. The password is required to extract the file.
Creates a password-protected ZIP archive containing a single file. Reads the entire source file into memory, creates a ZIP archive, and adds the file with password encryption 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_add_mem_ex_v2) for password protection. Extracts just the filename from sourcePath for the archive entry. The password is required to extract the file. Useful for securing sensitive files in compressed archives.