Thursday, September 06, 2007

Simple directory browser for Amazon S3

If you have used Amazon S3, you might be annoyed at the lack of support for directory browsing. If you hit your repo url, all you get is an XML file listing your content. So I wrote this small javascript to read that XML file, then display as a directory tree just like you're browsing an FTP site.

For example, say Terracotta has a S3 repo at http://download.terracotta.org. If you click on that link, you'll get an XML file. Now I want to be able to see what we have under http://download.terracotta.org/maven2, you'll get nothing but an error trying to go there.

My javascript is under the page http://download.terracotta.org/maven2/index.html

Just right click on that page and read the source, the javascript is pretty simple. Could have been made better or fancier but I'm no javascript guru :)

Maybe it could be of use for you.

Note: S3 doesn't serve index.html file automatically (after all, it's not a web server) so you have to hit the index.html explicitly.

5 comments:

Florent Ramière said...

pretty smart, you seem to have good fun coding at terracotta :)

jeka911 said...

nice. good idea.

toomim said...

Awesome! I WANT this!

But that link doesn't work anymore... where'd your code go? Can I use it?

toomim said...

Ah, found it at http://download.terracotta.org/index.html

I made a couple changes, here's my version:
http://toomimusic.s3.amazonaws.com/index.html

Luis said...

Good, I am going to try to use it. Thank you very much.

P.D. I don't see what you changed, it is going to take me a while.