This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
50 lines
1.2 KiB
6 years ago
|
/**
|
||
|
* Module dependencies.
|
||
|
*/
|
||
|
|
||
|
var fs = require('fs');
|
||
|
var parse = require('./parse');
|
||
|
var deprecate = require('util-deprecate');
|
||
|
|
||
|
/**
|
||
|
* Module exports.
|
||
|
*/
|
||
|
|
||
|
exports.parseFile = deprecate(parseFile, '`parseFile()` is deprecated. ' +
|
||
|
'Use `parseString()` instead.');
|
||
|
exports.parseFileSync = deprecate(parseFileSync, '`parseFileSync()` is deprecated. ' +
|
||
|
'Use `parseStringSync()` instead.');
|
||
|
|
||
|
/**
|
||
|
* Parses file `filename` as a .plist file.
|
||
|
* Invokes `fn` callback function when done.
|
||
|
*
|
||
|
* @param {String} filename - name of the file to read
|
||
|
* @param {Function} fn - callback function
|
||
|
* @api public
|
||
|
* @deprecated use parseString() instead
|
||
|
*/
|
||
|
|
||
|
function parseFile (filename, fn) {
|
||
|
fs.readFile(filename, { encoding: 'utf8' }, onread);
|
||
|
function onread (err, inxml) {
|
||
|
if (err) return fn(err);
|
||
|
parse.parseString(inxml, fn);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Parses file `filename` as a .plist file.
|
||
|
* Returns a when done.
|
||
|
*
|
||
|
* @param {String} filename - name of the file to read
|
||
|
* @param {Function} fn - callback function
|
||
|
* @api public
|
||
|
* @deprecated use parseStringSync() instead
|
||
|
*/
|
||
|
|
||
|
function parseFileSync (filename) {
|
||
|
var inxml = fs.readFileSync(filename, 'utf8');
|
||
|
return parse.parseStringSync(inxml);
|
||
|
}
|