I have a simple test flow to demonstrate my problem. This is my flow
[{"id":"d32c1f48.87f48","type":"tab","label":"Test flow","disabled":false,"info":""},{"id":"8c67530a.53a1f","type":"inject","z":"d32c1f48.87f48","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":319.5,"y":239,"wires":[["ef562e25.8545e"]]},{"id":"ef562e25.8545e","type":"function","z":"d32c1f48.87f48","name":"","func":"msg.payload = { \"adapterId\": \"0050c07cf4\", \"deviceId\": \"0022092258389225\", \"deviceType\": \"Blood-Pressure\", \"dateRecorded\": \"2018-12-18 11:57:44\", \"client\": \"raspberry\", \"properties\": [ { \"code\": \"sys\", \"unit\": \"mmHg\", \"value\": \"132.000000\" }, { \"code\": \"dia\", \"unit\": \"mmHg\", \"value\": \"85.000000\" }, { \"code\": \"pulse\", \"unit\": \"mmHg\", \"value\": \"100.000000\" } ]};\nreturn msg;","outputs":1,"noerr":0,"x":469,"y":241,"wires":[["3377130a.538fcc"]]},{"id":"3377130a.538fcc","type":"file","z":"d32c1f48.87f48","name":"","filename":"/home/pi/Desktop/JsonFiles/test.json","appendNewline":true,"createDir":false,"overwriteFile":"true","x":728.5,"y":244,"wires":[]},{"id":"6ea3ecd4.894714","type":"debug","z":"d32c1f48.87f48","name":"debugger","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":650.5,"y":125,"wires":[]},{"id":"c163c369.5e44b","type":"watch","z":"d32c1f48.87f48","name":"","files":"/home/pi/Desktop/JsonFiles/","recursive":"","x":344.5,"y":129,"wires":[["6ea3ecd4.894714"]]}]
When i create a new file watch node fires 2 events instead of 1 (the creation of the file). The weird thing is that the size of the file on the first event is showing as 0 and on the second event is the real size . What am i missing?