Run nfetch in the browser
A tiny HTTP client that fetches a URL through NanoVM's host network bridge (/dev/__net__).
Try it live
Nothing is downloaded until you press Run.
Fetch a URL from inside the VM
Installs nfetch 0.1.0 from the signed catalog (every chunk is verified before it is written), then runs the commands below in the VM's shell.
nfetch https://cdn.jsdelivr.net/npm/@userland-run/nano-catalog@0.0.12/package.json
$ nfetch https://cdn.jsdelivr.net/npm/@userland-run/nano-catalog@0.0.12/package.json
{
"name": "@userland-run/nano-catalog",
"version": "0.0.12",
"description": "Signed nano app catalog index (served via jsDelivr).",
"license": "AGPL-3.0-only OR LicenseRef-UEL",
"files": [
"index.json"
],
"publishConfig": {
"access": "public"
}
}What it is
nfetch is a small Rust program from the catalog itself. It writes a request to the /dev/__net__ device, which NanoVM forwards to the host's fetch(), and prints the response body (-i keeps the headers). In the browser the request is subject to CORS, so cross-origin URLs need CORS headers or the CORS proxy.
Package facts
- version
0.1.0- runs on
- RISC-V VM (
elf-app,riscv64gc-linux-musl) - download
- 191 kB compressed · 1 file
- command
nfetch- requires
- nothing else — a static binary
- license
AGPL-3.0-only OR LicenseRef-UEL(upstream)- upstream
- github.com/userland-run/catalog/tree/main/recipes/nfetch
- categories
- Networking
- catalog
- generation 12, Ed25519-signed
Install and run it from your page
With the SDK, installApp resolves nfetch in the signed index, fetches its content-addressed chunks from the CDN, verifies each one and writes the files into the VM. Details in Installing catalog apps.
import { createNano } from "@userland-run/nano-sdk";
const nano = await createNano({ image: { wasm: "/nano/console.wasm" }, ramMB: 512 });
await nano.installApp("nfetch"); // signature-verified, cached in OPFS
const r = await nano.shExec("nfetch https://cdn.jsdelivr.net/npm/@userland-run/nano-catalog@0.0.12/package.json");
console.log(r.stdout);Typical usage of the upstream command-line tool:
nfetch -i https://example.com/
Caveats
- net — Needs network access. In the browser, requests go through NanoVM's network bridge to the host's fetch(), so cross-origin URLs need CORS headers or the CORS proxy.
Related apps
- gix0.55.0The gitoxide command line: a pure-Rust implementation of git for inspecting and working with repositories.RISC-V VMnet9.4 MB
- hello-c1.0.0A minimal C program that prints one fixed line — the catalog's smoke test for the C toolchain path.RISC-V VM3.8 kB
- busybox1.36.1Hundreds of standard Unix utilities (sh, ls, grep, sed, awk, tar…) in a single small binary.RISC-V VM780 kB