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
Typescript
Module System
Min. Node Version
Node Version
NPM Version
98.5
Supply Chain
99
Quality
77.3
Maintenance
100
Vulnerability
100
License
JavaScript (88.46%)
TypeScript (11.54%)
Total Downloads
14,909,660,728
Last Day
13,273,885
Last Week
63,256,739
Last Month
288,846,837
Last Year
3,304,978,874
MIT License
2,578 Stars
225 Commits
131 Forks
22 Watchers
1 Branches
49 Contributors
Updated on May 07, 2025
Minified
Minified + Gzipped
Latest Version
14.1.0
Package Id
globby@14.1.0
Unpacked Size
28.31 kB
Size
6.92 kB
File Count
7
NPM Version
10.9.2
Node Version
23.6.1
Published on
Feb 08, 2025
Cumulative downloads
Total Downloads
Last Day
5.2%
13,273,885
Compared to previous day
Last Week
-8.2%
63,256,739
Compared to previous week
Last Month
-0.3%
288,846,837
Compared to previous month
Last Year
9.1%
3,304,978,874
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.
Returns a Promise<(path: URL | string) => boolean>
indicating whether a given path is ignored via the ignore files.
This is a more generic form of the isGitIgnored
function, 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.
Takes cwd?: URL | string
as options.
1import {isIgnoredByIgnoreFiles} from 'globby'; 2 3const isIgnored = await isIgnoredByIgnoreFiles("**/.gitignore"); 4 5console.log(isIgnored('some/file'));
Returns a (path: URL | string) => boolean
indicating whether a given path is ignored via the ignore files.
This is a more generic form of the isGitIgnoredSync
function, 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.
Takes cwd?: URL | string
as options.
1import {isIgnoredByIgnoreFilesSync} from 'globby'; 2 3const isIgnored = isIgnoredByIgnoreFilesSync("**/.gitignore"); 4 5console.log(isIgnored('some/file'));
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
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 11/30 approved changesets -- score normalized to 3
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
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 2025-04-28
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