FormData API. Start with an HTTP server that serves an HTML form.
Define the HTML form in another file,
index.html.
index.html
Run the server and visit
localhost:4000 to see the form.
The form sends a
POST request with the form data to the /action endpoint. Handle that request in the server.
First, call .formData() on the incoming Request to asynchronously parse its contents into a FormData instance. Then use .get() to extract the name and profilePicture fields; name is a string and profilePicture is a Blob.
Finally, write the Blob to disk with Bun.write().