cURL for WASI
v8.22.0WASIcURL 8.22.0 for command-line programs under wasmtime, precompiled for wasm32-wasip3, single-threaded as @crossbind/port-curl-wasi.
Install
A URL tool on libcurl, and the curl command itself
WASI has no JavaScript bindings: the program is a main() that links libcurl, built into one .wasm and run with wasmtime. This one is a small trurl: it parses a URL with the flags curl uses before a transfer, follows a Location header and appends encoded query pairs, without opening a connection. For transfers, @crossbind/port-curl-bin-wasi ships the curl command itself, which fetches over wasi:sockets with OpenSSL and verifies certificates: npx -p @crossbind/port-curl-bin-wasi@beta curl-wasi -sS https://example.com -o page.html.
Command-line tools
One upstream command ships as npm executables built for wasm32-wasip3. They need wasmtime on PATH and no compiler - see WASI commands.
curl-wasi
What is different on WASI
- There are no JavaScript bindings:
src/nativeprovidesmain(int, char**), and the build is a single.wasm. - Files come from the host through
--dirpreopens;--dir=.gives the program the current directory. crossbind build -p wasi -b releasewrites the program to.crossbind/build/<name>-wasi-wasm32-st-release.wasm.- WASI 0.3's
wasi:cli/exitcarries success or failure only, so any non-zero return frommainreaches the shell as exit code 1. - The build needs wasi-sdk 34 or newer (
WASI_SDK_PATH) or the crossbind Docker image; running needs wasmtime 47 or newer. See WASI.
Other platforms
- cURL overview: the apps, every platform's setup and the packages.
- cURL for WebAssembly: browsers, Node.js and edge runtimes.
- cURL for Android: React Native apps on Android.
- cURL for iOS: React Native apps on iOS.
Facts on this page come from the port manifests in the repository and from what npm served on beta when the site was built. See the Libraries guide for the full consumer flow.