function
fs.glob
Retrieves the files matching the specified pattern.
When followSymlinks is enabled, detected symbolic link cycles are not traversed recursively.
import { glob } from 'node:fs';
glob('*.js', (err, matches) => {
if (err) throw err;
console.log(matches);
});Retrieves the files matching the specified pattern.
When followSymlinks is enabled, detected symbolic link cycles are not traversed recursively.
import { glob } from 'node:fs';
glob('*.js', (err, matches) => {
if (err) throw err;
console.log(matches);
});Retrieves the files matching the specified pattern.
When followSymlinks is enabled, detected symbolic link cycles are not traversed recursively.
import { glob } from 'node:fs';
glob('*.js', (err, matches) => {
if (err) throw err;
console.log(matches);
});Retrieves the files matching the specified pattern.
When followSymlinks is enabled, detected symbolic link cycles are not traversed recursively.
import { glob } from 'node:fs';
glob('*.js', (err, matches) => {
if (err) throw err;
console.log(matches);
});Referenced types
interface GlobOptionsWithFileTypes
- exclude?: readonly string[] | (fileName: Dirent) => boolean
Function to filter out files/directories or a list of glob patterns to be excluded. If a function is provided, return
trueto exclude the item,falseto include it. If a string array is provided, each string should be a glob pattern that specifies paths to exclude. Note: Negation patterns (e.g., '!foo.js') are not supported. - followSymlinks?: boolean
When
true, symbolic links to directories are followed while expanding**patterns.
interface GlobOptionsWithoutFileTypes
- exclude?: readonly string[] | (fileName: string) => boolean
Function to filter out files/directories or a list of glob patterns to be excluded. If a function is provided, return
trueto exclude the item,falseto include it. If a string array is provided, each string should be a glob pattern that specifies paths to exclude. Note: Negation patterns (e.g., '!foo.js') are not supported. - followSymlinks?: boolean
When
true, symbolic links to directories are followed while expanding**patterns.
interface GlobOptions<T extends Dirent | string = Dirent | string>
- exclude?: readonly string[] | (fileName: T) => boolean
Function to filter out files/directories or a list of glob patterns to be excluded. If a function is provided, return
trueto exclude the item,falseto include it. If a string array is provided, each string should be a glob pattern that specifies paths to exclude. Note: Negation patterns (e.g., '!foo.js') are not supported. - followSymlinks?: boolean
When
true, symbolic links to directories are followed while expanding**patterns.