refactor: move fs util into template.js

This commit is contained in:
Jun Yang
2018-10-01 22:06:03 +08:00
parent 5412c5a39f
commit 8a629980d9
3 changed files with 9 additions and 18 deletions
-15
View File
@@ -1,15 +0,0 @@
import fs from 'fs'
export function readFileAsync (filepath) {
return new Promise(function (resolve, reject) {
fs.readFile(filepath, 'utf8', function (err, content) {
err ? reject(err) : resolve(content)
})
})
};
export function statFileAsync (path) {
return new Promise(function (resolve, reject) {
fs.stat(path, (err, stat) => err ? reject(err) : resolve(stat))
})
};