zip 格式文件压缩解压模块
使用方法:
var zip = require('zip');
| Type | Method and Description |
|---|---|
| const | public const ZIP_STOREDZIP_STOREDZIP_STORED压缩类型常量, 不压缩, 仅存储 |
| const | public const ZIP_DEFLATEDZIP_DEFLATEDZIP_DEFLATED压缩类型常量, 需要依赖zlib库进行压缩 |
| Type | Method and Description |
|---|---|
| Boolean | isZipFile(String filename)判断文件是否是zip格式 |
| ZipFile | open(String path,String mod,Integer compress_type)打开一个zip文件 |
| ZipFile | open(Buffer data,String mod,Integer compress_type)打开一个zip文件 |
| ZipFile | open(SeekableStream strm,String mod,Integer compress_type)打开一个zip文件 |
public const ZIP_STOREDZIP_STOREDZIP_STORED压缩类型常量, 不压缩, 仅存储
public const ZIP_DEFLATEDZIP_DEFLATEDZIP_DEFLATED压缩类型常量, 需要依赖zlib库进行压缩
isZipFile(String filename)判断文件是否是zip格式
filename 文件名返回true代表文件是zip文件
open(String path,String mod,Integer compress_type)打开一个zip文件
path 文件路径
mod 打开文件模式, “r”代表读取, “w”代表创建, “a”代表在zip文件后追加
compress_type 压缩类型, ZIP_STORED 代表不压缩, 仅存储。 默认使用ZIP_DEFLATED 代表使用zlib库进行压缩。
返回zip文件对象
open(Buffer data,String mod,Integer compress_type)打开一个zip文件
data zip文件数据
mod 打开文件模式, “r”代表读取, “w”代表创建, “a”代表在zip文件后追加
compress_type 压缩类型, ZIP_STORED 代表不压缩, 仅存储。 默认使用ZIP_DEFLATED 代表使用zlib库进行压缩。
返回zip文件对象
open(SeekableStream strm,String mod,Integer compress_type)打开一个zip文件
strm zip文件流
mod 打开文件模式, “r”代表读取, “w”代表创建, “a”代表在zip文件后追加
compress_type 压缩类型, ZIP_STORED 代表不压缩, 仅存储。 默认使用ZIP_DEFLATED 代表使用zlib库进行压缩。
返回zip文件对象