mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
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 <git@riskymh.dev>
This commit is contained in:
@@ -23,8 +23,8 @@ To listen to changes in subdirectories, pass the `recursive: true` option to `fs
|
|||||||
```ts
|
```ts
|
||||||
import { watch } from "fs";
|
import { watch } from "fs";
|
||||||
|
|
||||||
const watcher = watch(import.meta.dir, { recursive: true }, (event, filename) => {
|
const watcher = watch(import.meta.dir, { recursive: true }, (event, relativePath) => {
|
||||||
console.log(`Detected ${event} in ${filename}`);
|
console.log(`Detected ${event} in ${relativePath}`);
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user