diff --git a/README.md b/README.md index 635754e..cdb9e53 100644 --- a/README.md +++ b/README.md @@ -122,3 +122,16 @@ Types: | Method | Deno | Node | Bun | Base implementation | | --------- | ---- | ---- | --- | ------------------- | | FSWatcher | X | X | X | node:fs/promises | + +Examples: + +```typescript +const watcher = FsWatcher(); +for await (const event of watcher.watch(tempdir)) { + if (event.kind === "modify" && filePath == event.paths[0]) { + console.log(event); + break; // Stop watching after the first creation event + } +} +watcher.close(); +```