entybion/node_modules/file.js
2014-05-01 15:09:46 +02:00

19 lines
No EOL
438 B
JavaScript

var fs = require('fs');
function File() {
function open(path, document) {
fs.readFile(path, 'utf-8', function (error, contents) {
document.getElementById('editor').value = contents;
});
}
function save(path, document) {
var text = document.getElementById('editor').value;
fs.writeFile(path, text);
}
this.open = open;
this.save = save;
}
module.exports = new File;