lucasburlingham.me

ls for the web, in Rust

As part of my ongoing effort to learn something new everyday, I decided to do something completely new and learn the Rust programming language. I've heard plenty of good things about it and wanted to see how well my PHP and Python skills would translate over to a more complex environment.

Turns out that the leg work is done for you if you pay $120/year for GitHub Copilot and use it to write the code for you. Cool.

But really, Rust has a lot of documentation and although being relatively newer than other similarly used languages such as C and C++, it has a lot of support and a lot of good libraries.

So here it is, an ls-adjacent command that runs in the browser. Fire it up with ./ls-web and you'll see the following: GNOME Terminal window showing cd Projects/rust_http_list/target/release/ and ./ls_web on two lines. Below it, the text Server started at: http://0.0.0.0:7878
Type CTRL+C to stop the server... is shown.

Note that I keep saying ls-adjacent command. This replicates the functionality of running the ls command with no command line options or flags in a directory on your machine. It lists the files and directories in a list with no formatting, making it easy to pipe to another command, just how UNIX intended.

Heres what that looks like in a browser:

examples
incremental
.fingerprint
deps
build
.cargo-lock
ls_web.d
Total files: 7

It's not spectactular and I'll be adding to it in the future, but for now you can try it yourself at github.com/lucasburlingham/ls_web. The binary for an x86_64 system running Linux is in the v1 release.

References