19 lines
No EOL
438 B
JavaScript
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; |