lazy require fs
This commit is contained in:
parent
d6937a7da2
commit
29d40186c9
@ -1,5 +1,3 @@
|
||||
var fs = require('fs');
|
||||
|
||||
function trim(string) {
|
||||
return string.replace(/^\s+|\s+$/g, '');
|
||||
}
|
||||
@ -13,7 +11,7 @@ var PO = function () {
|
||||
};
|
||||
|
||||
PO.prototype.save = function (filename, callback) {
|
||||
fs.writeFile(filename, this.toString(), callback);
|
||||
require('fs').writeFile(filename, this.toString(), callback);
|
||||
};
|
||||
|
||||
PO.prototype.toString = function () {
|
||||
@ -65,7 +63,7 @@ PO.prototype.toString = function () {
|
||||
};
|
||||
|
||||
PO.load = function (filename, callback) {
|
||||
fs.readFile(filename, 'utf-8', function (err, data) {
|
||||
require('fs').readFile(filename, 'utf-8', function (err, data) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user