swepam
Version:
a json interface to the swepam readings
19 lines (14 loc) • 494 B
JavaScript
;
var fs = require('fs');
var path = require('path');
var json = path.normalize(process.env.SWEPAM_JSON_PATH || __dirname);
exports.current = function(reading, done) {
fs.writeFile(json + '/current.json', reading, function(err) {
return typeof done === 'function' ? done(err) : undefined;
});
};
exports.all = function(readings, done) {
fs.writeFile(json + '/all.json', readings, function(err) {
return typeof done === 'function' ? done(err) : undefined;
});
};