Skip to content

Instantly share code, notes, and snippets.

@pavelpower
Last active December 27, 2015 03:59
Show Gist options
  • Save pavelpower/7263570 to your computer and use it in GitHub Desktop.
Save pavelpower/7263570 to your computer and use it in GitHub Desktop.
/**
* Created by mwmaleks on 29.10.13.
*/
var Certificate = require('../models/Certificate');
var path = "C:\\tmp\\testfile.txt";
var fs = require('fs');
function changeRonF(text) {
return text.replace('R', 'N');
}
//пример асинхронного запроса к файлу
exports.index = function(req, res ) {
fs.readFile(path, 'utf8', function (err, text) {
if (err)
res.render('error', err);
res.send(changeRonF(text));
});
res.send('white the file please');
};
exports.create = function(req, res ) {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment