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