From 02447d306d9570cb42e501a916854a1c83215954 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sun, 9 Jul 2023 16:30:55 +0300 Subject: [PATCH] Update file.js --- src/file.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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' }) }