# Question about watch node?

**URL:** <https://discourse.nodered.org/t/question-about-watch-node/35187>\
**Category:** General\
**Created:** [2 November 2020 03:38 UTC](https://discourse.nodered.org/t/question-about-watch-node/35187 "2020-11-02T03:38:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [2 November 2020 03:38 UTC](https://discourse.nodered.org/t/question-about-watch-node/35187/1 "2020-11-02T03:38:30Z")

</div>

I am not sure I understand the following...

**Note:** The directory or file must exist in order to be watched. If the file or directory gets deleted it may no longer be monitored even if it gets re-created.

If I have a flow that creates a file, I can't use a watch node to get the file size of the file I just created? That is what the above note implies to me. Can someone clarify if a watch node will or will not work correctly on a file just created?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 November 2020 09:04 UTC](https://discourse.nodered.org/t/question-about-watch-node/35187/2 "2020-11-02T09:04:15Z")

</div>

It means what it says... It can't get a handle on something that doesn't exist. So to watch for files being created you need to watch the directory they are in - not the filename you think they will be created as.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [2 November 2020 14:16 UTC](https://discourse.nodered.org/t/question-about-watch-node/35187/3 "2020-11-02T14:16:08Z")

</div>

What is the mechanism that is used? The inode? Something else? If the file exists, the watch node created, then the file is deleted and created again, this works. I have a flow right now that has never failed that matches the scenario I just noted.

You can watch for the flows file to be recreated on a deployment with a watch node for example. So I am trying to understand what the circumstances are for failure of a watch node, when right now, I have an example, where it does not fail. The 'may' wording needs some qualification in context of my question.

Per my understanding the flows file is a safe-save model, so could that be contributing factor? Fie content is replaced but file (handle) is not actually removed from the file system?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 November 2020 16:31 UTC](https://discourse.nodered.org/t/question-about-watch-node/35187/4 "2020-11-02T16:31:17Z")

</div>

it uses fs.stat (I think). I'm sure there was once a situation where on some OS they did not all behave the same. (maybe those without inodes)

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [2 November 2020 17:50 UTC](https://discourse.nodered.org/t/question-about-watch-node/35187/5 "2020-11-02T17:50:26Z")

</div>

Cool. thanks for the info. Gives me a place to start. 🙂 Right, usually when something is qualified, similar to this, OS specific limits can come into scope. Fortunately, I only have Linux/Pi based infrastructure. But I want to have at least one Windows based system for reference at some point as well.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 January 2021 17:50 UTC](https://discourse.nodered.org/t/question-about-watch-node/35187/6 "2021-01-01T17:50:43Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
