前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >NPM那些库(1):rimraf、chalk、glob、globby

NPM那些库(1):rimraf、chalk、glob、globby

作者头像
WEBJ2EE
发布2019-07-19 12:05:44
4K0
发布2019-07-19 12:05:44
举报
文章被收录于专栏:WebJ2EE

“NPM那些库” 是系列文章,每篇介绍几个 Node 环境中常用的库,目的是:总结、记录、分享

1. rimraf

rimraf 是 Linux 命令 rm -rf 的 node 版本。就是用来删除目录、删除文件的。

安装:

npm install --save rimraf

示例:

2. chalk

chalk(粉笔),顾名思义,它可以控制输出到 console 中文字的样式。

安装:

npm install --save chalk

示例:

3. glob

3.1. 什么是 glob 模式?

In computer programming, glob patterns specify sets of filenames with wildcard characters.

mv *.txt textfiles/ moves

moves (mv) all files with names ending in .txt from the current directory to the directory textfiles.

—— 来源于 Wiki

3.2. glob 的起源?

The command interpreters of the early versions of Unix relied on a separate program to expand wildcard characters in unquoted arguments to a command: /etc/glob. That program performed the expansion and supplied the expanded list of file paths to the command for execution. Its name is an abbreviation for "global command". Later, this functionality was provided as a library function, glob(), used by programs such as the shell.

—— 来源于 Wiki

下面要介绍的就是 Node 环境中的 glob 库,它可以让我们使用通配符去搜索文件

安装:

npm install --save glob

示例:

4. globby

globby 是 glob 的增强版本!

图:globby 的增强特性;

安装:

npm install --save glob

示例:

参考:

rimraf项目地址:https://github.com/isaacs/rimraf chalk项目地址:https://github.com/chalk/chalk glob项目地址:https://github.com/isaacs/node-glob globby项目地址:https://github.com/sindresorhus/globby

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2018-10-28,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 WebJ2EE 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档