npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zach-zip

v2.0.7

Published

process zip package

Downloads

13

Readme

Features 功能特性

  • 压缩文件生成zip压缩包。
  • 删掉zip压缩包中指定的文件。
  • 解压zip压缩包
  • 列出zip压缩包中的所有文件,包含文件的相关信息

Installation 安装

$ npm install zach-zip

问题反馈

接口

add( arg, callback ) 压缩文件

  • arg{Object}

    • output: {String}要生成的文件名,带后缀。
    • input {String|array}要被压缩的文件。字符串可以是一个文件,也可以是一个文件夹,可以使用通配符:*和?。*表示任意数量的字符序列,?表示任意一个字符。
    • r :{Boolean} 表示是否递归,例如当需要将子文件夹中的内容也压缩的时候,就需要设置r为true,默认为false。
    • p:{String} 密码,压缩的时候可以指定密码。
  • callback{Function}

    • err:{Object}
      • code:错误代码
        • 1: Warning
        • 2:Fatal error
        • 7:arg err
        • 8:Not enough memory for operation
        • 255:User stopped the process
    • des:描述

dele( arg, callback ) 从压缩包中删除文件

+arg{Object} * file{String} 要处理的压缩包名称 * target {String|array} 要删除的文件,字符串或字符串数组 * r{Boolean} 是否递归,默认为false

  • callback{Function}
    • err:{Object}
      • code:错误代码
        • 1: Warning
        • 2:Fatal error
        • 7:arg err
        • 8:Not enough memory for operation
        • 255:User stopped the process
    • des:描述

extracts(arg, callback) 解压文件

+arg{Object} * input{String} 要处理的压缩包路径 * o{String} 输出路径,默认是当前文件夹 * filter{String|array} 可以指定解压特定的文件 * r{Boolean}如果filter设定了过滤条件,设置r为true可以实现递归深度过滤

  • callback{Function}
    • err:{Object}
      • code:错误代码
        • 1: Warning
        • 2:Fatal error
        • 7:arg err
        • 8:Not enough memory for operation
        • 255:User stopped the process
    • des:描述

list(file, callback) 列出压缩包中的所有文件

  • file{String} 要处理的压缩包路径

  • callback{Function} * err:{Object} * code:错误代码 * 1: Warning * 2:Fatal error * 7:arg err * 8:Not enough memory for operation * 255:User stopped the process * des:描述

  • 返回{Object}

{
  path:// 压缩包的路径
  size:// 压缩包的大小,zip能读到这个数据,rar压缩包读不到这个数据(值是NAN)
  foldersNum:// 压缩包中文件夹的数量
  filesNum:// 压缩包中文件的数量
  files:[
     {
        name:
        date:
        time:
        size: // rar文件是0,zip能读出来
        compressed: // rar文件是0,zip能读出来
     }
     ……
  ]
}