From 65a215bb4e75ea11de5e6307cc3c30df60b7cf0c Mon Sep 17 00:00:00 2001 From: Braden Wong <13159333+braden-w@users.noreply.github.com> Date: Fri, 14 Nov 2025 06:10:35 -0800 Subject: [PATCH] docs(watch): use relativePath parameter name in recursive example (#24716) This updates the documentation for `fs.watch()` to use `relativePath` instead of `filename` in the recursive example, following the same convention from PR #23990. When `recursive: true` is set on `fs.watch()`, the callback receives a relative path to the changed file rather than just a simple filename. Using `relativePath` as the parameter name makes this distinction clearer to users. **Related to:** https://github.com/oven-sh/bun/pull/23990 Co-authored-by: Michael H --- docs/guides/read-file/watch.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/read-file/watch.mdx b/docs/guides/read-file/watch.mdx index ab27043c88..dde7a8c2a1 100644 --- a/docs/guides/read-file/watch.mdx +++ b/docs/guides/read-file/watch.mdx @@ -23,8 +23,8 @@ To listen to changes in subdirectories, pass the `recursive: true` option to `fs ```ts import { watch } from "fs"; -const watcher = watch(import.meta.dir, { recursive: true }, (event, filename) => { - console.log(`Detected ${event} in ${filename}`); +const watcher = watch(import.meta.dir, { recursive: true }, (event, relativePath) => { + console.log(`Detected ${event} in ${relativePath}`); }); ```