Skip to content

Commit 7ff7085

Browse files
committed
FsWatcher example
1 parent 6887626 commit 7ff7085

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,16 @@ Types:
122122
| Method | Deno | Node | Bun | Base implementation |
123123
| --------- | ---- | ---- | --- | ------------------- |
124124
| FSWatcher | X | X | X | node:fs/promises |
125+
126+
Examples:
127+
128+
```typescript
129+
const watcher = FsWatcher();
130+
for await (const event of watcher.watch(tempdir)) {
131+
if (event.kind === "modify" && filePath == event.paths[0]) {
132+
console.log(event);
133+
break; // Stop watching after the first creation event
134+
}
135+
}
136+
watcher.close();
137+
```

0 commit comments

Comments
 (0)