0

This is my first question on stackoverflow :) I am storing markdown files under public/files/ path. I want to list these markdown files in a component.

Actually I need the ls command in bash.

I don't want to make a JSON file and read all the markdown files because it's not scalable.

Anyone have an idea or solution?

I couldn't find a scalable way.

  • Using a datastore to save file locations is ***far*** more scalable than enumerating a physical directory. – Rory McCrossan Feb 19 '23 at 18:29
  • 1
    This can't be done directly from within clientside React, but if you're using Node as the server you could write a [script that returns the directory listing](https://stackoverflow.com/questions/2727167/how-do-you-get-a-list-of-the-names-of-all-files-present-in-a-directory-in-node-j), and have your React code make an api call to retrieve it. – Daniel Beck Feb 19 '23 at 18:32
  • I would worry less about scalability and more about UI clutter to be honest. You can easily handle say 200 files but how will that look like in your UI – apokryfos Feb 19 '23 at 18:51
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 19 '23 at 19:03

0 Answers0