diff --git a/src/file.js b/src/file.js index 5f02731..06bca55 100644 --- a/src/file.js +++ b/src/file.js @@ -1,6 +1,8 @@ const fs = require('fs') const path = require('path') +const glob = require('glob') +module.exports.list = list module.exports.read = read module.exports.write = write module.exports.resolve = resolve @@ -9,6 +11,14 @@ module.exports.dirname = dirname module.exports.templateVariables = templateVariables module.exports.templateFormat = templateFormat +function list(pattern) { + return new Promise(resolve => { + glob(pattern, function (err, files) { + resolve(files) + }) + }) +} + function read(filepath) { return fs.readFileSync(path.resolve(filepath), { encoding: 'utf-8' }) }