readFiles
Reads every file under a directory, recursively and sorted by path, yielding its bytes. Text and binary files both work.
It skips the code files importFiles imports, .map files, dotfiles, dot-folders and node_modules.
In a built bot the files come from the build output. A relative dir resolves against root, the same as importFiles.
Under seedcord dev and in a built bot, dir has to be one of the folders that files in seedcord.config.ts lists, or a subfolder of one.
Throws:
A SeedcordError when the directory or a file in it cannot be read.
A SeedcordError when
diris relative and the bot did not start throughseedcord devor its built output.A SeedcordError when
diris outside every folder infilesor has a dot-folder or node_modules in its path, underseedcord devor in a built bot.A SeedcordError when the directory was missing at build time, in a built bot.
readFiles(dir: string): AsyncGenerator<ReadFile>dir
dir: string