Skip to content

Commit

Permalink
Remove unused fileRead method
Browse files Browse the repository at this point in the history
versx committed Aug 22, 2020
1 parent 19bfd2f commit 2805c3a
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions src/services/utils.js
Original file line number Diff line number Diff line change
@@ -63,29 +63,12 @@ const fileExists = async (path) => {
});
};

const fileRead = async (path) => {
return new Promise((resolve, reject) => {
try {
fs.readFile(path, 'utf-8', (err, data) => {
if (err) {
return reject(err);
}
resolve(data);
});
} catch (e) {
return reject(e);
}
});
};

const render = async (name, data) => {
return new Promise(async (resolve, reject) => {
try {
const filePath = path.resolve(TemplatesDir, name + '.ejs');
if (!await fileExists(filePath)) {
const errMsg = `Template ${filePath} does not exist!`
console.error(errMsg);
return reject(errMsg);
return reject(`Template ${filePath} does not exist!`);
}
ejs.renderFile(filePath, data, (err, str) => {
if (err) {
@@ -107,6 +90,5 @@ module.exports = {
hasRole,
zeroPad,
fileExists,
fileRead,
render
};

0 comments on commit 2805c3a

Please sign in to comment.