00001 // procstat.js : Cat /proc/stat 00002 // Author: Eric Flumerfelt, FNAL RSI 00003 // Last Modified: December 23, 2014 00004 // Compatibility updates to work with serverbase.js v0.4 00005 // 00006 // procstat.js simply reads the /proc/stat file, and returns the data 00007 00008 // Node.js framework "includes" 00009 var fs = require('fs'); 00010 var emitter = require('events').EventEmitter; 00011 var procstat = new emitter(); 00012 00013 // Only function here...read the file 00014 procstat.GET_ = function () { 00015 fs.readFile('/proc/stat', function read(err, data) { 00016 if(err) throw err; 00017 // HTML-ize and send the data 00018 procstat.emit('end',data); 00019 }); 00020 } 00021 00022 module.exports = function (module_holder) { 00023 module_holder["procstat"] = procstat; 00024 };