Recursive file searching can be helpful if you are building a tool like jest or gest. For example, jest searches for files that match /(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$/i, and gest looks for /.*.(query|graphql|gql)$/i. I wanted to test my functional programming abilities and try to tackle this recursive problem as functionally as possible.
Implementation below
const gest = Gest(schema, options)
findFilesByPattern(/.*.(query|graphql|gql)$/i)
  .then(values =>
    Promise.all(values.map(v =>
      readFile(v)
        .then(gest))))
  .catch(console.log)