I have a simple application which is sending XML data to a SQS Queue. I am looking for a simple to implement fileWatcher watching a directory in node that would return more information than fs.watch.
Here's what I am trying to achieve:
- XML File is dropped in a directory
- Filwatcher creates a trigger
- Trigger start a function which uses fs.readFile
- File data is stored into a variable
- Another function send variable to a SQS Queue
- data succesfully posted to queue
- File is moved to an archive directory
Although fs.watch would trigger an event and therefore start the read function, there is not enough information returned in the callback to allow me to differentiate when a new file is added or the file that created that trigger in the first place is simply moved to the archive directory.
Since, I am quite novice with Javascript and Node.js, I am looking for a filewatcher which is as easy to implement as fs.watch but would return information like file added, file changed, file moved, file deleted in the callback. Alternatively a different way to implement fs.watch that would allow me to implement the above would be great.