import { globSync } from 'node:fs';
console.log(globSync('*.js'));
function
fs.globSync
paths of files that match the pattern.
import { globSync } from 'node:fs';
console.log(globSync('*.js'));
paths of files that match the pattern.
import { globSync } from 'node:fs';
console.log(globSync('*.js'));
paths of files that match the pattern.
import { globSync } from 'node:fs';
console.log(globSync('*.js'));
paths of files that match the pattern.
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.
class Dirent<Name extends string | Buffer = string>
A representation of a directory entry, which can be a file or a subdirectory within the directory, as returned by reading from an fs.Dir. The directory entry is a combination of the file name and file type pairs.
Additionally, when readdir or readdirSync is called with the withFileTypes option set to true, the resulting array is filled with fs.Dirent objects, rather than strings or Buffer s.
- name: Name
The file name that this
fs.Direntobject refers to. The type of this value is determined by theoptions.encodingpassed to readdir or readdirSync. Returns
trueif thefs.Direntobject describes a block device.Returns
trueif thefs.Direntobject describes a character device.Returns
trueif thefs.Direntobject describes a file system directory.Returns
trueif thefs.Direntobject describes a first-in-first-out (FIFO) pipe.Returns
trueif thefs.Direntobject describes a regular file.Returns
trueif thefs.Direntobject describes a socket.Returns
trueif thefs.Direntobject describes a symbolic link.
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.
interface GlobOptions
- exclude?: readonly string[] | (fileName: string | Dirent<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.