Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative: Deno.fsEvents #12

Closed
mikaello opened this issue Apr 9, 2020 · 3 comments
Closed

Alternative: Deno.fsEvents #12

mikaello opened this issue Apr 9, 2020 · 3 comments

Comments

@mikaello
Copy link

mikaello commented Apr 9, 2020

The new function Deno.fsEvents can watch file changes:

const iter = Deno.fsEvents("./mod.ts");

for await (const event of iter) {
  console.log(">>>> event", event); //e.g. { kind: "modify", paths: [ "/Users/mikaello/mod.ts" ] }
}

and possibly make the implementation in this repo simpler, or even replace it completely.

UPDATE: fsEvents is renamed to watchFs.

@konsumer
Copy link

konsumer commented May 18, 2020

Or watchFs:

const watcher = Deno.watchFs(Deno.cwd());

for await (const event of watcher) {
  console.log(event); // { kind: "modify", paths: [ "/Users/konsumer/denodemo/watch.ts" ] }
}

This example is from the docs

@mikaello
Copy link
Author

@konsumer great catch, Deno.watchFs is actually the same function, it recently changed name (I just figured out) :-)

@jinjor
Copy link
Owner

jinjor commented Jun 2, 2020

Sorry for the delay. Just updated the doc to inform people to use the new API instead.
Thank you!

@jinjor jinjor closed this as completed Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants