温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/fs/glob
点击访问原文链接

Node fs.glob function | API Reference | Bun

Node fs.glob function | API Reference | BunBuildDocsReferenceGuidesBlogDiscord/node:fs/globFglob

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:fs/globFglob

function

fs.glob { if (err) throw err; console.log(matches); }); ```" data-algolia-static="false" data-algolia-merged="false" data-type="Function">function glob(pattern: string | readonly string[],callback: (err: null | ErrnoException, matches: string[]) => void): void;

Retrieves the files matching the specified pattern.

import { glob } from 'node:fs';

glob('*.js', (err, matches) => {
if (err) throw err;
console.log(matches);
});
function glob(pattern: string | readonly string[],options: GlobOptionsWithFileTypes,callback: (err: null | ErrnoException, matches: Direntstring>[]) => void): void;

Retrieves the files matching the specified pattern.

import { glob } from 'node:fs';

glob('*.js', (err, matches) => {
if (err) throw err;
console.log(matches);
});
function glob(pattern: string | readonly string[],options: GlobOptionsWithoutFileTypes,callback: (err: null | ErrnoException, matches: string[]) => void): void;

Retrieves the files matching the specified pattern.

import { glob } from 'node:fs';

glob('*.js', (err, matches) => {
if (err) throw err;
console.log(matches);
});
function glob(pattern: string | readonly string[],options: GlobOptions,callback: (err: null | ErrnoException, matches: string[] | Direntstring>[]) => void): void;

Retrieves the files matching the specified pattern.

import { glob } from 'node:fs';

glob('*.js', (err, matches) => {
if (err) throw err;
console.log(matches);
});
Referenced typesinterface GlobOptionsWithFileTypescwd?: string | URL

Current working directory.

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 true to exclude the item, false to 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.

withFileTypes: true

true if the glob should return paths as Dirents, false otherwise.

interface GlobOptionsWithoutFileTypescwd?: string | URL

Current working directory.

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 true to exclude the item, false to 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.

withFileTypes?: false

true if the glob should return paths as Dirents, false otherwise.

interface GlobOptionscwd?: string | URL

Current working directory.

exclude?: readonly string[] | (fileName: string | Direntstring>) => boolean

Function to filter out files/directories or a list of glob patterns to be excluded. If a function is provided, return true to exclude the item, false to 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.

withFileTypes?: boolean

true if the glob should return paths as Dirents, false otherwise.

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

Node fs.glob function | API Reference | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for function node:fs.glob | Bun