userland.run70Try the demo
Catalog app · RISC-V VM

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.

catalog app

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.

bash
nfetch https://cdn.jsdelivr.net/npm/@userland-run/nano-catalog@0.0.12/package.json
loading…
Expected output
$ 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.

javascript
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:

bash
nfetch -i https://example.com/

Caveats

← All 32 catalog apps