Gathering detailed insights and metrics for globby
Gathering detailed insights and metrics for globby
Gathering detailed insights and metrics for globby
Gathering detailed insights and metrics for globby
npm install globby
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
2,537 Stars
222 Commits
130 Forks
23 Watching
1 Branches
49 Contributors
Updated on 28 Nov 2024
Minified
Minified + Gzipped
JavaScript (88.45%)
TypeScript (11.55%)
Cumulative downloads
Total Downloads
Last day
-7.1%
12,595,050
Compared to previous day
Last week
1.3%
73,051,834
Compared to previous week
Last month
11.1%
302,283,111
Compared to previous month
Last year
5%
3,182,579,996
Compared to previous year
User-friendly glob matching
Based on fast-glob
but adds a bunch of useful features.
['foo*', '!foobar']
foo
→ foo/**/*
.gitignore
and similar ignore config filesURL
as cwd
1npm install globby
├── unicorn
├── cake
└── rainbow
1import {globby} from 'globby'; 2 3const paths = await globby(['*', '!cake']); 4 5console.log(paths); 6//=> ['unicorn', 'rainbow']
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use path.posix.join()
instead of path.join()
.
Returns a Promise<string[]>
of matching paths.
Type: string | string[]
See supported minimatch
patterns.
Type: object
See the fast-glob
options in addition to the ones below.
Type: boolean | string[] | object
Default: true
If set to true
, globby
will automatically glob directories for you. If you define an Array
it will only glob files that matches the patterns inside the Array
. You can also define an object
with files
and extensions
like below:
1import {globby} from 'globby'; 2 3const paths = await globby('images', { 4 expandDirectories: { 5 files: ['cat', 'unicorn', '*.jpg'], 6 extensions: ['png'] 7 } 8}); 9 10console.log(paths); 11//=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg']
Note that if you set this option to false
, you won't get back matched directories unless you set onlyFiles: false
.
Type: boolean
Default: false
Respect ignore patterns in .gitignore
files that apply to the globbed files.
Type: string | string[]
Default: undefined
Glob patterns to look for ignore files, which are then used to ignore globbed files.
This is a more generic form of the gitignore
option, allowing you to find ignore files with a compatible syntax. For instance, this works with Babel's .babelignore
, Prettier's .prettierignore
, or ESLint's .eslintignore
files.
Returns string[]
of matching paths.
Returns a stream.Readable
of matching paths.
For example, loop over glob matches in a for await...of
loop like this:
1import {globbyStream} from 'globby'; 2 3for await (const path of globbyStream('*.tmp')) { 4 console.log(path); 5}
Convert a path to a pattern. Learn more.
Returns an Promise<object[]>
in the format {patterns: string[], options: Object}
, which can be passed as arguments to fast-glob
. This is useful for other globbing-related packages.
Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.
Returns an object[]
in the format {patterns: string[], options: Object}
, which can be passed as arguments to fast-glob
. This is useful for other globbing-related packages.
Takes the same arguments as generateGlobTasks
.
Returns a boolean
of whether there are any special glob characters in the patterns
.
Note that the options affect the results.
This function is backed by fast-glob
.
Returns a Promise<(path: URL | string) => boolean>
indicating whether a given path is ignored via a .gitignore
file.
Takes cwd?: URL | string
as options.
1import {isGitIgnored} from 'globby'; 2 3const isIgnored = await isGitIgnored(); 4 5console.log(isIgnored('some/file'));
Returns a (path: URL | string) => boolean
indicating whether a given path is ignored via a .gitignore
file.
Takes cwd?: URL | string
as options.
Just a quick overview.
*
matches any number of characters, but not /
?
matches a single character, but not /
**
matches any number of characters, including /
, as long as it's the only thing in a path part{}
allows for a comma-separated list of "or" expressions!
at the beginning of a pattern will negate the matchVarious patterns and expected matches.
No vulnerabilities found.
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 12/30 approved changesets -- score normalized to 4
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More