MCPcopy Create free account
hub / github.com/editablejs/editable / getFiles

Function getFiles

apps/docs/src/pages/[[...markdownPath]].js:205–214  ·  view source on GitHub ↗
(dir)

Source from the content-addressed store, hash-verified

203
204 // Find all MD files recursively.
205 async function getFiles(dir) {
206 const subdirs = await readdir(dir)
207 const files = await Promise.all(
208 subdirs.map(async subdir => {
209 const res = resolve(dir, subdir)
210 return (await stat(res)).isDirectory() ? getFiles(res) : res.slice(rootDir.length + 1)
211 }),
212 )
213 return files.flat().filter(file => file.endsWith('.md'))
214 }
215
216 // 'foo/bar/baz.md' -> ['foo', 'bar', 'baz']
217 // 'foo/bar/qux/index.md' -> ['foo', 'bar', 'qux']

Callers 1

getStaticPathsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…