Skip to content
/ file-set Public

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

License

Notifications You must be signed in to change notification settings

75lb/file-set

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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-24 Lloyd Brookes <[email protected]>.

Tested by test-runner.

About

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

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks