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

globby-compress

v1.1.9

Published

globby-compress

Downloads

14

Readme

globby-compress

功能介绍

  1. 按需压缩目录,提供过滤规则设置如 !node_modules/**/* ,支持多次添加目录
  2. 支持多 glob pattern
  3. 基于 globbyarchiver
  4. 将当前工程 dist 目录打成指定名称的压缩包, 全局安装后:gbc dist project1
  5. 2021-4-17 新增解压 unzip 包命令: gbc unzip <zipFile> ./ , 将 zip 文件解压到指定路径
  6. 2021-4-17 新增解压 zip 包命令: gbc zip <zipFile> --dir?=xxx , 将当前目录下的所有文件压缩到指定文件,已排除zip文件自身

安装

yarn add globby-compress 
//or 
npm install globby-compress 
// 对应全局命令名 globby-compress 或者 简称 gbc

使用

  import GlobbyCompress from 'globby-compress'
  // 第一个参数指压缩包放置路径
  // 第二个参数为globby pattern参数,可以是单个pattern字符串,或者pattern字符串数组 ["**/*.js"]
  // 第三个参数 可选 globby options,如:{cwd,dot} ,默认 cwd 为 process.cwd()
 const globbyCompress = new GlobbyCompress('./temp/temp1.zip',
        ['**/*.md', '!node_modules/**/*'])
    try {
        // 追加压缩信息
        globbyCompress.add('**/*.ts')
        // 执行压缩行为,函数返回值为zip文件的体积
        const byteSize = await globbyCompress.compress()
        console.log(byteSize) // 返回压缩包文件体积
    } catch (e) {
        console.error(e)
    }  

cli模式

npm i -g globby-compress 

gbc start <zipFilePath> [patterns..]

gbc start ./abc.zip **/*.js !node_modules !dist --log


// 将当前目录下的文件压缩成 `xxx.zip` , 可选配置 `--dir` 参数指定子目录进行压缩

gbc zip xxx.zip  --dir=dist 

// 将当前目录下的 `yyy.zip` 文件解压到当前目录的 `./`

gbc unzip yyy.zip ./