libzip开发笔记(一):libzip库介绍、编译和工程模板

简介: libzip开发笔记(一):libzip库介绍、编译和工程模板

前言

  Qt使用一些压缩解压功能,选择libzip库,libzip库比较原始,也是很多其他库的基础支撑库。


libzip

  libzip是一个C库,用于读取,创建和修改zip档案。可以从数据缓冲区,文件或直接从其他zip归档文件直接复制的压缩数据中添加文件。在不关闭存档的情况下所做的更改可以还原。

  当前版本是1.7.3,于2020年7月15日发布。

  官网:https://libzip.org/

  QQ群:1047134658(点击“文件”搜索“libzip”,群内与博文同步更新)


libzip编译

步骤一:解压

步骤二:Cmake配置(vs2017 x64版本)

  需要zlib,之前已经编译过vs2017 x64版本的zlib了,导入再配置

步骤三:生成工程

步骤四:打开VS2017编译

步骤五:安装install


模块化


补充:查看命令行工具帮助和源码辅助开发

ziptool.exe -h
usage: ziptool.exe [-ceghnrst] [-l len] [-o offset] archive command1 [args] [command2 [args] ...]
Supported options are:
        -c              check consistency
        -e              error if archive already exists (only useful with -n)
        -g              guess file name encoding (for stat)
        -h              display this usage
        -l len          only use len bytes of file
        -n              create archive if it doesn't exist
        -o offset       start reading file at offset
        -r              print raw file name encoding without translation (for stat)
        -s              follow file name convention strictly (for stat)
        -t              disregard current archive contents, if any
Supported commands and arguments are:
        add name content
            add file called name using content
        add_dir name
            add directory
        add_file name file_to_add offset len
            add file to archive, len bytes starting from offset
        add_from_zip name archivename index offset len
            add file from another archive, len bytes starting from offset
        cat index
            output file contents to stdout
        count_extra index flags
            show number of extra fields for archive entry
        count_extra_by_id index extra_id flags
            show number of extra fields of type extra_id for archive entry
        delete index
            remove entry
        delete_extra index extra_idx flags
            remove extra field
        delete_extra_by_id index extra_id extra_index flags
            remove extra field of type extra_id
        get_archive_comment
            show archive comment
        get_extra index extra_index flags
            show extra field
        get_extra_by_id index extra_id extra_index flags
            show extra field of type extra_id
        get_file_comment index
            get file comment
        get_num_entries flags
            get number of entries in archive
        name_locate name flags
            find entry in archive
        print_progress
            print progress during zip_close()
        rename index name
            rename entry
        replace_file_contents index data
            replace entry with data
        set_archive_comment comment
            set archive comment
        set_extra index extra_id extra_index flags value
            set extra field
        set_file_comment index comment
            set file comment
        set_file_compression index method compression_flags
            set file compression method
        set_file_dostime index time date
            set file modification time and date (DOS format)
        set_file_encryption index method password
            set file encryption method
        set_file_mtime index timestamp
            set file modification time
        set_file_mtime_all timestamp
            set file modification time for all files
        set_password password
            set default password for encryption
        stat index
            print information about entry
Supported flags are:
        0       (no flags)
        C       ZIP_FL_NOCASE
        c       ZIP_FL_CENTRAL
        d       ZIP_FL_NODIR
        l       ZIP_FL_LOCAL
        u       ZIP_FL_UNCHANGED
Supported compression methods are:
        default
        deflate
        store
Supported encryption methods are:
        none
        AES-128
        AES-192
        AES-256
        PKWARE
The index is zero-based.


工程模板v1.0.0

  对应工程模板:zipDemo_v1.0.0_基础模板_zip库的基础环境.rar


相关文章
|
Java API Android开发
DDS、FastDDS、OpenDDS扫盲
DDS、FastDDS、OpenDDS扫盲
2823 0
|
缓存 JSON 前端开发
CORS 详解,终于不用担心跨域问题了
CORS 详解,终于不用担心跨域问题了
8525 1
CORS 详解,终于不用担心跨域问题了
|
Windows
zlib、libzip、 libzippp 库编译(windows + cmake + vs2013)
"libzipp" 这库是基于 "libzip" 之上封装的,而 "libzip" 又是基于 "zlib"库封装的,所以要编译 "libzipp" 库就要先编译其他两个库。下载准备:"zlib-1.2.
4027 0
|
人工智能 算法 安全
使用libzip压缩文件和文件夹
使用libzip压缩文件和文件夹
239 3
EMQ
|
缓存 数据可视化 物联网
在 Windows 上搭建 MQTT 消息服务器
本文将以NanoMQ为例,演示如何通过安装包和源代码编译两种安装方式,在Windows系统中快速搭建一个可以支持多协议连接的物联网MQTT消息服务器。
EMQ
845 0
|
机器学习/深度学习 前端开发 JavaScript
WebAssembly:让前端性能突破极限的秘密武器
WebAssembly(简称 WASM)作为前端开发的性能加速器,能够让代码像 C++ 一样在浏览器中高速运行,突破了 JavaScript 的性能瓶颈。本文详细介绍了 WebAssembly 的概念、工作原理以及其在前端性能提升中的关键作用。通过与 JavaScript 的配合,WASM 让复杂运算如图像处理、3D 渲染、机器学习等在浏览器中流畅运行。文章还探讨了如何逐步集成 WASM,展示其在网页游戏、高计算任务中的实际应用。WebAssembly 为前端开发者提供了新的可能性,是提升网页性能、优化用户体验的关键工具。
5462 2
WebAssembly:让前端性能突破极限的秘密武器
|
缓存 JavaScript 前端开发
拿下奇怪的前端报错(三):npm install卡住了一个钟- 从原理搞定安装的全链路问题
本文详细分析了 `npm install` 过程中可能出现的卡顿问题及解决方法,包括网络问题、Node.js 版本不兼容、缓存问题、权限问题、包冲突、过时的 npm 版本、系统资源不足和脚本问题等,并提供了相应的解决策略。同时,还介绍了开启全部日志、使用替代工具和使用 Docker 提供 Node 环境等其他处理方法。
8736 1
|
存储 缓存 安全
https访问提示不安全,证书密钥验证上如何解决
【10月更文挑战第4天】访问提示不安全,证书密钥验证上如何解决
1488 2
解锁Qt QListWidget的全部潜力——用最佳实践和技巧赢得用户的喜爱和赞誉!
解锁Qt QListWidget的全部潜力——用最佳实践和技巧赢得用户的喜爱和赞誉!
488 1
|
安全 Linux 网络安全
【工具使用】几款优秀的SSH连接客户端软件工具推荐FinalShell、Xshell、MobaXterm、OpenSSH、PUTTY、Terminus、mRemoteNG、Terminals等
【工具使用】几款优秀的SSH连接客户端软件工具推荐FinalShell、Xshell、MobaXterm、OpenSSH、PUTTY、Terminus、mRemoteNG、Terminals等
122011 0