file-set

Cross-platform glob expansions simplified. Input: file paths and glob expressions. Output: resolved file paths organised by type (file, directory and not-found).

MIT 37 个版本
安装
npm install file-set
yarn add file-set
pnpm add file-set
bun add file-set
README

view on npm npm module downloads Gihub repo dependents Gihub package dependents Node.js CI

file-set

Cross-platform glob expansions simplified. Input: file paths and glob expressions. Output: resolved file paths organised by type (file, directory and not-found). It handles all the cross-platform issues associated with file paths.

Particularly useful for handling user input, for example a CLI utility which accepts a list of file paths and globs.

$ example-utility index.js * not/existing/*

The example-utility above could pass its user input into FileSet. Call await .add(<string[]>) as many times as necessary, adding more path/glob expressions each time.

import FileSet from 'file-set'
const fileSet = new FileSet()
await fileSet.add([ 'index.js', '*', 'not/existing/*' ])
console.log(fileSet)

The output has been organised into sets. Any duplicates caused by overlapping glob expressions are removed.

FileSet {
  files: [ 'index.js', 'LICENSE', 'package.json', 'README.md' ],
  dirs: [ 'jsdoc2md/', 'lib/', 'node_modules/', 'test/' ],
  notExisting: [ 'not/existing/*' ]
}

© 2014-25 Lloyd Brookes <opensource@75lb.com>.

版本列表
6.0.1 2024-08-26
6.0.0 2024-08-25
5.3.0 2025-07-17
5.2.2 2024-08-31
5.2.1 2024-08-31
5.2.0 2024-08-30
5.1.3 2022-01-14
5.1.2 2021-08-13
5.1.1 2021-07-24
5.1.0 2021-07-24
5.0.1 2021-06-29
5.0.0 2021-06-06
4.0.2 2021-03-13
4.0.1 2020-05-25
4.0.0 2020-05-25
3.0.0 2019-11-02
2.0.1 2018-09-24
2.0.0 2018-02-23
1.1.2 2018-09-24
1.1.1 2016-10-04
1.1.0 2016-10-04
1.0.2 2016-08-20
1.0.1 2016-07-30
1.0.0 2016-03-03
0.2.8 2015-10-13
0.2.7 2015-04-13
0.2.6 2015-03-01
0.2.5 2015-02-23
0.2.4 2015-02-22
0.2.3 2015-01-11
0.2.2 2014-11-19
0.2.1 2014-07-09
0.2.0 2014-06-22
0.1.1 2014-06-13
0.1.0 2014-06-09
0.0.1 2014-06-04
0.0.0 2014-06-04