diff options
Diffstat (limited to 'src/util/io.js')
-rw-r--r-- | src/util/io.js | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src/util/io.js b/src/util/io.js deleted file mode 100644 index 6cc89b5..0000000 --- a/src/util/io.js +++ /dev/null @@ -1,21 +0,0 @@ -// Utility functions for interacting with files and other external data -// interfacey constructs. - -import {readdir} from 'fs/promises'; -import * as path from 'path'; - -export async function findFiles(dataPath, { - filter = () => true, - joinParentDirectory = true, -} = {}) { - let files; - try { - files = await readdir(dataPath); - } catch (error) { - throw new AggregateError([error], `Failed to list files from ${dataPath}`); - } - - return files - .filter((file) => filter(file)) - .map((file) => (joinParentDirectory ? path.join(dataPath, file) : file)); -} |