Giter Site home page Giter Site logo

A few feature requests about node-watch HOT 10 OPEN

yuanchuan avatar yuanchuan commented on August 25, 2024 5
A few feature requests

from node-watch.

Comments (10)

yuanchuan avatar yuanchuan commented on August 25, 2024

Hi @POPCORNS1068,

The last two features actually are more likely based on the first one. But I'm concerned about the efficiency of scanning when the directory is too deep.

It did that in earlier versions of node-watch (<=0.3.x) and it's hard to go back now.

Anyway, PRs are welcome and I'd love to add the create event if it is implemented other than scanning.

from node-watch.

 avatar commented on August 25, 2024

Maybe make them optional like the recursive option?

from node-watch.

 avatar commented on August 25, 2024

Oops that was unintentional

from node-watch.

yuanchuan avatar yuanchuan commented on August 25, 2024

That may be huge work :D
Could you share your current workarounds?

from node-watch.

 avatar commented on August 25, 2024

For the initial scan, I used this snippet here (modified to create a tree instead of a list): https://stackoverflow.com/questions/5827612/node-js-fs-readdir-recursive-directory-search.

I made it add the found dirs/files to a tree and keep it updated with the change events (add updated dir/file into tree if it's not already in it, remove if it's removed)

As for the last one, since I already have a tree of files, when a remove event occurs for a directory, I remove (and report) that dir and it's contents in that tree, recursively.

I'm not that into js so that's I could come up with.

from node-watch.

yuanchuan avatar yuanchuan commented on August 25, 2024

I'm going to leave it open to see if anyone upvote for this.

from node-watch.

kgrajek avatar kgrajek commented on August 25, 2024

"Initial Scan" would be great feature!

from node-watch.

octachrome avatar octachrome commented on August 25, 2024

I am also switching from chokidar (because recursively watching on Windows locks all subdirectories so that they cannot be renamed or deleted), and I have similar feature requests:

  • I implemented initial scan using readdirp, with a counter to ensure the scan stops early when the directory tree is too deep
  • I am thinking of implementing individual file events on rm -rf by maintaining a list of all files in the directory
  • I also need to workaround an issue on Linux where copying a deep directory structure into a watched directory does not fire events for new files, because the recursive watch is added too slowly. I will probably resolve this by using readdirp to find the directory contents whenever a new directory is created.

from node-watch.

fabiospampinato avatar fabiospampinato commented on August 25, 2024

I would very much like to see the points in the first post addressed, especially the third one would be a deal breaker for me, if a file is deleted and I don't get an event about that file I'd consider it a bug even.

from node-watch.

fabiospampinato avatar fabiospampinato commented on August 25, 2024

I wanted to submit a PR with those missing features, but I ended up rewriting the whole thing, now it should do pretty much everything except for supporting symlinks, I'll leave a link to it here in case somebody here is interested: https://www.npmjs.com/package/watcher

from node-watch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.