nmon

0.2.2 • Public • Published

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();

Readme

Keywords

none

Package Sidebar

Install

npm i nmon

Weekly Downloads

4

Version

0.2.2

License

none

Last publish

Collaborators

  • qbit