# Check when finished reading the whole file

**URL:** <https://discourse.nodered.org/t/check-when-finished-reading-the-whole-file/58610>\
**Category:** General\
**Created:** [18 February 2022 15:47 UTC](https://discourse.nodered.org/t/check-when-finished-reading-the-whole-file/58610 "2022-02-18T15:47:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlfEng](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@AlfEng](https://discourse.nodered.org/u/AlfEng)\
**Post date:** [18 February 2022 15:47 UTC](https://discourse.nodered.org/t/check-when-finished-reading-the-whole-file/58610/1 "2022-02-18T15:47:03Z")

</div>

I read a csv file and send a message for each line in the file.  
Now I would like to save in an file in append mode the last file read with the number of lines read.  
So I need a trigger to know when it has finished reading the whole file and transmitted all the messages and then writing to the file.  
How can I do?  
Thank you

---

<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:** [18 February 2022 15:54 UTC](https://discourse.nodered.org/t/check-when-finished-reading-the-whole-file/58610/2 "2022-02-18T15:54:43Z")

</div>

If you are using the read file node - set to output one line at a time - then if you look at complete msg in debug you will see a msg.part property... Only the last one sent will have a `msg.parts.count` property - which will indeed hold the number of lines in the file.

---

<div class="post-metadata">

**Author:** ![AlfEng](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@AlfEng](https://discourse.nodered.org/u/AlfEng)\
**Post date:** [18 February 2022 16:02 UTC](https://discourse.nodered.org/t/check-when-finished-reading-the-whole-file/58610/3 "2022-02-18T16:02:51Z")

</div>

Thanks dceejay.

---

<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:** [4 March 2022 16:03 UTC](https://discourse.nodered.org/t/check-when-finished-reading-the-whole-file/58610/4 "2022-03-04T16:03:12Z")

</div>

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