title: watch file for new content and retrieve that content in NodeJS
body: <p>I am monitoring the file for content change using Node.js watch File. Its succesfully calling the event when content of the file is modified</p>
  
  <pre><code>fs.watchFile(filePath, ()=&gt; {
      console.log('File Changed ...');
      file = fs.readFileSync(filePath);
      console.log('File content at : ' + new Date() + ' is \n' + file);
  });
  </code></pre>
  
  <p>from <strong>Hello</strong> to <strong>Hello World</strong> </p>
  
  <p>I want only the <strong>World</strong> not all the contents of the file, can any one suggest the most efficient way to achieve this or any node package to achieve this. I looked at node package Chokidar but that also monitors the change.</p>
  
  <p>I found a JAVA Solution for that, but not sure of any Node.js alternative for that.</p>
  
  <p><a href="https://stackoverflow.com/questions/24301511/how-to-watch-file-for-new-content-and-retrieve-that-content">How to watch file for new content and retrieve that content</a> </p>
  
  <p>I did my research tried to follow these posts</p>
  
  <p><a href="https://nodejs.org/api/fs.html#fs_fs_watchfile_filename_options_listener" rel="noreferrer">https://nodejs.org/api/fs.html#fs_fs_watchfile_filename_options_listener</a></p>
  
  <p><a href="http://www.codingdefined.com/2015/09/how-to-monitor-file-for-modifications.html" rel="noreferrer">http://www.codingdefined.com/2015/09/how-to-monitor-file-for-modifications.html</a></p>
  
  <p><a href="https://stackoverflow.com/questions/13698043/observe-file-changes-with-node-js">Observe file changes with node.js</a></p>
  
  <p>Thanks</p>