title: node.js check if copying new file to disk has finished
body: <p>I'm trying to write a tethered shooting app with electron / node.js.</p>
  
  <p>The communication between camera and computer is managed by the software, which ships with the camera. The new pictures are directly copied to my local hard disk. After that my app should show the new picture as fast as possible.</p>
  
  <p>I set up a chokidar watcher for the directory where my new pictures arrive. Unfortunately the </p>
  
  <p><code>awaitWriteFinish: {stabilityThreshold: 500, pollInterval: 50}</code></p>
  
  <p>option of chokidar acts very slowly and sometimes triggers the add-event too early.</p>
  
  <p>My idea to circumvent this was to write my own polling mechanism after the watcher (without awaitWriteFinish option) triggers an event.</p>
  
  <p>I tried fs.stats for polling but fs.stats doesn't recognize the current file size but the total file size.</p>
  
  <p>Is there a easy node.js / javascript / jquery approach to detect if the new file is completely written to disk?</p>
  
  <p>Any help apprechiated.</p>