diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-08-19 11:51:13 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-08-19 12:24:03 -0300 |
commit | 9e4a20224a2cc005775cb99b5ea888c253e48e3a (patch) | |
tree | 7757c2b5a269657a760a076fd25e724457c4941b /src/util/io.js | |
parent | 3b601adf3945a487f4aa07eb8c0f62161460345a (diff) |
util: remove findFiles util, adapt traverse
Diffstat (limited to 'src/util/io.js')
-rw-r--r-- | src/util/io.js | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/util/io.js b/src/util/io.js deleted file mode 100644 index 12e87f4d..00000000 --- a/src/util/io.js +++ /dev/null @@ -1,23 +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 Object.assign( - new AggregateError([error], `Failed to list files from ${dataPath}`), - {code: error.code}); - } - - return files - .filter((file) => filter(file)) - .map((file) => (joinParentDirectory ? path.join(dataPath, file) : file)); -} |