Fork me on GitHub

gulp常用插件之del使用

更多gulp常用插件使用请访问:gulp常用插件汇总


del这是一款删除文件的工具。

更多使用文档请点击访问del工具官网

安装

npm install del

API

  • del(patterns, options)

返回Promise<string[]>带有删除路径的路径。

  • del.sync(patterns, options)

返回string[]带有删除路径的路径。

参数解析

  • patterns
    类型: string | string[]

  • options
    类型: object
    您可以指定任何的globby选项,除了以下选项。与此相反的 globby 默认值,expandDirectoriesonlyFiles ,和followSymbolicLinksfalse 默认。

  • force
    类型:boolean
    默认值:false
    允许删除当前工作目录和外部目录。

  • dryRun
    类型:boolean
    默认值:false
    查看将被删除的内容。

const del = require('del');
(async () => {
	const deletedPaths = await del(['temp/*.js'], {dryRun: true});
	console.log('Files and directories that would be deleted:\n', deletedPaths.join('\n'));
})();
 
  • concurrency
    类型:number
    默认值:Infinity
    最小值:1
    并发限制。
posted @ 2019-12-13 01:45  较瘦  阅读(1789)  评论(0编辑  收藏  举报
知识点文章整理