1.2.0 • Published 4 years ago
deep-scan-dir v1.2.0
deep-scan-dir
专注于深度扫描给定文件夹,额外仅支持了忽略行为。
目录
安装
# 使用 NPM
$ npm i deep-scan-dir
# 使用 Yarn
$ yarn add deep-scan-dir
deepScanDir({from, exclude})
from
{String} 目标文件或文件夹,默认:.
exclude
{Object}dir
{String | Array} 文件夹忽略规则file
{String | Array} 文件忽略规则
- 返回: {Promise} 扫描到的文件夹、文件
使用
import { realpathSync } from 'fs';
// import { deepScanDir } from 'deep-scan-dir';
import deepScanDir from 'deep-scan-dir/lib/deepScanDir';
(async () => {
const {dirs, files} = await deepScanDir({
from: realpathSync(process.cwd()),
exclude: {
dir: [
'node_modules',
'.git',
],
},
});
})();
deepScanDirSync({from, exclude})
from
{String} 目标文件或文件夹,默认:.
exclude
{Object}dir
{String | Array} 文件夹忽略规则file
{String | Array} 文件忽略规则
- 返回: {Object} 扫描到的文件夹、文件
dirs
{Array} 扫描到的文件夹files
{Array} 扫描到的文件
使用
import { realpathSync } from 'fs';
// import { deepScanDirSync } from 'deep-scan-dir';
import deepScanDirSync from 'deep-scan-dir/lib/deepScanDirSync';
const {dirs, files} = deepScanDirSync({
from: realpathSync(process.cwd()),
exclude: {
dir: [
'node_modules',
'.git',
],
},
});
贡献指南
仔细查阅 CONTRIBUTING.md 以了解详情。
证书
deep-scan-dir
获得了 MIT 许可,仔细查阅 LICENSE.md 以了解详情。