entybion/node_modules/file.js

19 lines
438 B
JavaScript
Raw Permalink Normal View History

2014-05-01 15:09:46 +02:00
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;