| 482 | ) |
| 483 | |
| 484 | const watch = ( |
| 485 | backend: Option.Option<FileSystem.WatchBackend["Service"]>, |
| 486 | path: string, |
| 487 | options?: FileSystem.WatchOptions |
| 488 | ) => |
| 489 | Effect.all([stat(path), Effect.serviceOption(FileSystem.WatchBackend)]).pipe( |
| 490 | Effect.map(([info, callerBackend]) => |
| 491 | Option.orElse(callerBackend, () => backend).pipe( |
| 492 | Option.flatMap((backend) => backend.register(path, info, options)), |
| 493 | Option.getOrElse(() => watchNative(path, options)) |
| 494 | ) |
| 495 | ), |
| 496 | Stream.unwrap |
| 497 | ) |
| 498 | |
| 499 | const writeFile: FileSystem.FileSystem["writeFile"] = (path, data, options) => { |
| 500 | const flag = options?.flag ?? "w" |