Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jinjor/deno-watch
A pure deno file watcher.
https://github.com/jinjor/deno-watch
deno
Last synced: 20 days ago
JSON representation
A pure deno file watcher.
- Host: GitHub
- URL: https://github.com/jinjor/deno-watch
- Owner: jinjor
- License: mit
- Created: 2019-01-03T20:00:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-02T17:48:54.000Z (over 4 years ago)
- Last Synced: 2024-11-11T12:42:12.378Z (about 1 month ago)
- Topics: deno
- Language: TypeScript
- Size: 22.5 KB
- Stars: 44
- Watchers: 2
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-deno - watch - 文件监听器。 (Uncategorized / Uncategorized)
- awesome-deno - watch - A file watcher.![GitHub stars](https://img.shields.io/github/stars/jinjor/deno-watch?style=plastic) (Modules / Online Playgrounds)
- awesome-deno - watch - A file watcher. (Modules / Utils)
- awesome-deno-cn - @jinjor/watch
README
# Deprecated
Use `Deno.watchFs()` instead!
# Watch
[![Build Status](https://travis-ci.org/jinjor/deno-watch.svg?branch=master)](https://travis-ci.org/jinjor/deno-watch)
[![Build status](https://ci.appveyor.com/api/projects/status/ri4l7qbn314e1uww?svg=true)](https://ci.appveyor.com/project/jinjor/deno-watch)A pure deno file watcher.
## Example
```typescript
import watch from "https://deno.land/x/[email protected]/mod.ts";for await (const changes of watch("src")) {
console.log(changes.added);
console.log(changes.modified);
console.log(changes.deleted);
}
``````typescript
const end = watch("src").start(changes => {
console.log(changes);
});
```## Options
Written in the [source code](./mod.ts).
## Benchmark
```
test Benchmark
generated 10930 files.
[Add]
took 183ms to traverse 11232 files
took 147ms to traverse 11542 files
took 142ms to traverse 11845 files
[Modify]
took 139ms to traverse 11891 files
took 136ms to traverse 11891 files
took 154ms to traverse 11891 files
[Delete]
took 138ms to traverse 11608 files
took 134ms to traverse 11274 files
took 145ms to traverse 10960 files
... ok
```Try yourself:
```
deno https://deno.land/x/watch/test.ts --allow-write
```## Limitations
- Changes within 1s cannot be detected.
- Symlink may not work on Windows.## License
MIT