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

fs: add fsPromises.watch() #37179

Closed
wants to merge 2 commits into from
Closed

Commits on Feb 15, 2021

  1. fs: add fsPromises.watch()

    An alternative to `fs.watch()` that returns an `AsyncIterator`
    
    ```js
    const { watch } = require('fs/promises');
    
    (async () => {
    
      const ac = new AbortController();
      const { signal } = ac;
      setTimeout(() => ac.abort(), 10000);
    
      const watcher = watch('file.txt', { signal });
    
      for await (const { eventType, filename } of watcher) {
        console.log(eventType, filename);
      }
    
    })()
    ```
    
    Signed-off-by: James M Snell <jasnell@gmail.com>
    jasnell committed Feb 15, 2021
    Copy the full SHA
    d5f74c6 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    6e27a09 View commit details
    Browse the repository at this point in the history