import { readdirSync } from "fs" import { resolve } from "path" export const scanDir = (dirname: string) => { const dirpath = resolve(__dirname, `../${dirname}`) const res = readdirSync(dirpath) const markdownFileNames = res.filter((name) => name.endsWith('.md')) return markdownFileNames.map(v => { return { filename: v, link: resolve(dirpath, v) } }) }