nmon

Monitor remote files ( http currently ) for file modifications

npm install nmon
5 downloads in the last week
22 downloads in the last month

Nmon

Fire events when the http 'last-modified' header is changed for a file.

Build Status

Currently only http is supported

Usage

Install

npm install nmon

Examples

Monitoring a single file


var nmon = require( 'nmon' );
var mon = new nmon();

mon.create( 'http', {
    interval: 1000,
    name: 'potato',
    url: 'http://localhost:3000/file'
});

mon.on( 'potato', function( obj ) {
    console.log( 'potato has been updated: %s', obj.date );
});

mon.monitor();

Monitoring multiple files


var nmon = require( 'nmon' );
var mon = new nmon();

var srs = [
    { 
        interval: 1000,
        name: 'file1',
        url: 'http://localhost:3000/file1',
    },

    { 
        interval: 1000,
        name: 'file2',
        url: 'http://localhost:3000/file2',
    },
];


var i = 0, l = srs.length;
for ( ; i < l; i++ ) {
    var a = srs[i]
    mon.create( 'http', a );
    mon.on( a.name, function( o ) {
        console.log( 'TEST', o.name, o.date );
    });
}

mon.monitor();
npm loves you