Socket
Socket
Sign inDemoInstall

file-set

Package Overview
Dependencies
12
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    file-set

Expands file paths and glob expressions, returning matched and unmatched files and directories


Version published
Weekly downloads
218K
decreased by-5.47%
Maintainers
1
Install size
173 kB
Created
Weekly downloads
 

Readme

Source

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

file-set

Expands a list of paths and glob expressions into three sets: "files", "directories" and "not existing". Each set in the output is a list of unique paths.

The library saves you the job of learning a globbing library, expanding a glob expression (e.g. lib/**/*), sifting through each result testing whether it's a file, directory or neither.

Usage

Expand two glob expressions ('*' and 'not/existing/*').

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

The output has been organised into sets.

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

API

file-set

FileSet ⏏

Kind: Exported class

new FileSet()

fileSet.files : Array.<string>

The existing files found

Kind: instance property of FileSet

fileSet.dirs : Array.<string>

The existing directories found. Directory paths will always end with '/'.

Kind: instance property of FileSet

fileSet.notExisting : Array.<string>

Paths which were not found

Kind: instance property of FileSet

fileSet.add(patterns)

Add file patterns to the set.

Kind: instance method of FileSet

ParamTypeDescription
patternsstring | Array.<string>One or more file paths or glob expressions to inspect.

© 2014-22 Lloyd Brookes <75pound@gmail.com>.

Tested by test-runner.

FAQs

Last updated on 14 Jan 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc