Skip to content

Commit 65a215b

Browse files
braden-wRiskyMH
andauthored
docs(watch): use relativePath parameter name in recursive example (oven-sh#24716)
This updates the documentation for `fs.watch()` to use `relativePath` instead of `filename` in the recursive example, following the same convention from PR oven-sh#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:** oven-sh#23990 Co-authored-by: Michael H <git@riskymh.dev>
1 parent c3c9144 commit 65a215b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/guides/read-file/watch.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ To listen to changes in subdirectories, pass the `recursive: true` option to `fs
2323
```ts
2424
import { watch } from "fs";
2525

26-
const watcher = watch(import.meta.dir, { recursive: true }, (event, filename) => {
27-
console.log(`Detected ${event} in ${filename}`);
26+
const watcher = watch(import.meta.dir, { recursive: true }, (event, relativePath) => {
27+
console.log(`Detected ${event} in ${relativePath}`);
2828
});
2929
```
3030

0 commit comments

Comments
 (0)