Monitor if a file/directory is growing in size and execute a callback function when its size is stabilized.
A node.js module that allows to monitor if a file/directory is growing in size and execute a callback function when its size is stabilized.
Install globally with npm:
$ npm install snitch -g
snitch module exports the
onStopGrowing function. The
onStopGrowing function checks in configurable intervals the size of a file/directory. When two consecutive size-checks return the same size, a final pollings mechanism is triggered. If during the final polling the file/directory-size remained the same the callback is invoked.
If you want to use the module with default settings just pass as arguments a file/directory-path and the callback you want to invoke
var snitch = ;snitch;
If you want to override the default options of the module, the 'onStopGrowing' function accepts as a third argument an object with three configurable properties. You can either override one, or all of them.
var options =interval: x // in millisecondspollingTimes: y // a numbertimeout: z // in milliseconds;snitch;
Run the tests
$ npm test
Copyright (c) 2014 Ioannis Tzanellis
Released under the MIT license