Skip to content

fs: add ignore option to fs.watch - #61433

Merged
nodejs-github-bot merged 8 commits into
nodejs:mainfrom
mcollina:fs-watch-ignore-option
Jan 22, 2026
Merged

nodejs-github-bot merged 8 commits into
nodejs:mainfrom
mcollina:fs-watch-ignore-option

Conversation

@mcollina

Copy link
Copy Markdown
Member

Add an ignore option to fs.watch() to filter filesystem events.

Type: string | RegExp | Function | Array<string | RegExp | Function>

fs.watch(dir, { ignore: '*.log' });
fs.watch(dir, { ignore: /\.tmp$/ });
fs.watch(dir, { ignore: (f) => f.startsWith('.') });
fs.watch(dir, { ignore: ['*.log', /\.tmp$/] });