Outputting file changes using a tail node

You can monitor files for changes. Whenever a monitored file changes, a message containing the changes is injected into the flow.

  1. Open Node-RED.
  2. Add a tail node from the storage category to the workspace.
  3. Double-click the tail node to open the Edit tail node dialogue.
  4. In the Filename text box, specify the path to the file that you want to monitor (e. g. /home/admin/user).
  5. notice

    The memory card is accessible at the file path /run/media/mmcblk0p1/.

  6. In the File type drop-down list, select whether you want to monitor a text file or a binary file.
  7. notice

    The output of a tail node depends on the type of file. Changes to a text file are output as strings. Changes to a binary file are output as buffer objects.

  8. If you are monitoring a text file and want to replace \n by line breaks in the output , enable the Split lines on \n? check box.
  9. Click Done to apply your changes.
  10. Add more nodes to the workspace and connect them to a flow with the tail node being the first node.