artdaq_node_server  v1_00_11
 All Classes Namespaces Files Variables
procstat_module.js
1 // procstat.js : Cat /proc/stat
2 // Author: Eric Flumerfelt, FNAL RSI
3 // Last Modified: December 23, 2014
4 // Compatibility updates to work with serverbase.js v0.4
5 //
6 // procstat.js simply reads the /proc/stat file, and returns the data
7 
8 // Node.js framework "includes"
9 var fs = require('fs');
10 var emitter = require('events').EventEmitter;
11 var procstat = new emitter();
12 
13 // Only function here...read the file
14 procstat.GET_ = function () {
15  fs.readFile('/proc/stat', function read(err, data) {
16  if(err) throw err;
17  // HTML-ize and send the data
18  procstat.emit('end',data);
19  });
20 }
21 
22 module.exports = function (module_holder) {
23  module_holder["procstat"] = procstat;
24 };