Installation
npm install --save filelistener
Usage
File listener watches a directory for a file and once the file is available in the folder, it allows for certain tasks to be executed like sending the file as an attachment in a mail, placing the file into a different folder (timestamped if required) or any other user defined task.
Creating a file listener
The first step is to create a listener configuration.
const module = ; //any custom taskvar custom = { listener; } ; var specification = module ;
Build and start listener
The next step is to build and start listener.
var listener = module;listenerstart;
Custom task
For any custom task, the consumer object must have a method 'subscribeFileListener', which subscribes to the 'fileAvailable' event emitted by the listener object, available as an input argument.
var custom = { listener; } ;
License
Licensed under MIT