diff --git a/server/parser/filesystem.js b/server/parser/filesystem.js new file mode 100644 index 0000000..c868667 --- /dev/null +++ b/server/parser/filesystem.js @@ -0,0 +1,24 @@ +import fs from "fs"; + +/* +This file provider allows the application to use a local folder containing +parsable (.html) files, instead of downloading them from the internet. + +This can be especially useful for development. +*/ + +export class FileSystemClient { + constructor(path) { + this.path = path; + } + + getFiles() { + const contents = []; + const files = fs.readdirSync(this.path); + for (const file of files) { + const data = fs.readFileSync(this.path + "/" + file).toString(); + contents.push(data); + } + return contents; + } +}