I have a static website running on Amazon S3, where I store .txt, .pdf, and .svg files in my Bucket. I'm looking to display just the names of these files (without their content) on my HTML site using JavaScript. Since users can upload files to the bucket regularly, the filenames keep changing, which is why I need to list them dynamically. Instead of displaying all the files, I want to show an HTML file with a table listing files from a specific folder in the bucket.
I am only using plain JS for browsers, no Node.js or additional modules to keep the project simple.
I've explored tutorials on utilizing Node.js modules like 'fs' in the browser with tools like Browserify, but haven't been successful yet. I also came across FileSystemDirectoryReader for JS, but it's not widely supported. Would WebKitFileSystem be a suitable alternative? Most filesystem APIs seem to work with virtual directories rather than the specific directory I require.
Do I really need npm modules since I'm not accessing the client filesystem but my own filesystem on S3? I've already retrieved data from these files using XMLHttpRequest, but can I simply list their names?
It would be ideal if I could use code like this: var arrFiles = []; arrFiles = readFiles("./files/*");
Another option could be using AWS Lambda to fetch all file names, save them in a text file as a list, then read that file with JS to display the names on the website. This approach seems complex.
If there are any suggestions or solutions, I'd appreciate your input. Thanks in advance.