Most of my focus these days is on LLMs. I have a million things to say, and I'll break my blogging-sabbatical at some point to write more in-depth on the topic. Until then, I wanted to say something about eget-wasm.
For one of the projects I'm working on, I need to be able to download binary releases from GitHub. Doing this reliably for arbitrary projects is surprisingly hard, since no one can agree on how you should format your URLs (e.g., how to name things so that you include the platform, arch, etc). A year ago Taras introduced me to eget, this amazing little Go binary that solves the problem perfectly. Since then, we've used it for lots of things, and it's my go-to solution.
But for eget to work, you need to have it installed on your system. There are various ways to install it, but for my use case, I need to be able to use it via TypeScript and node.js, and have it work on any platform/arch combo that the user might be running using only the NPM ecosystem.
There are various solutions to this problem. For example, esbuild uses optionalDependencies with pre-built versions for more than a dozen platform/arch combos and the hurl project uses a post install script. The Sentry Engineering blog has a nice write-up on how they do it.
Another way to do this is using WebAssembly WASM and the WebAssembly System Interface (WASI). For whatever reason, I wanted to try doing it this way. So a few weeks ago I tried to casually bait Taras into porting eget to WASM for me. The next day I woke up to this on Discord:
i have eget in wasm for you
LLMs are great, but having your friends write code for you while you sleep is even better and I highly recommend it.
Taras and I write a lot of code relay style, where one of us starts something, pushes it to GitHub and goes to bed, only to have it get picked up by the other person and improved. We worked on eget-wasm this way, with Taras doing the Go bits, and me working on the node.js part.
You can read about Taras' approach to overcoming a lack of networking in WASI here, which was really clever. For my part, I used this as an excuse to try playing with doing a pure JS thing that also does full type checking and supports TS types. I'm not sure I'd uses this style for something any larger than eget.js, but it was fun to try using JSDoc comments and jsconfig.json on this project.
Using eget-wasm, you can do something as simple as this to download the latest version of sops from GitHub for the current system:
import { eget } from 'eget-wasm';
await eget('getsops/sops');
The rest of the API is documented in the repo and the package lives on NPM as eget-wasm.
Working on this has sparked a renewed interest in WASM, and I hope to find other uses for it down the road.