FormData
formdata api, new FormData(form), multipart/form-dataDefinition
The Web API that represents a form’s fields as a list of name–value pairs — new FormData(formElement) reads them all, .append() adds one, .entries() iterates — and that fetch sends as multipart/form-data, which is how a file upload reaches a server; on the server, readFormData(event) or readMultipartFormData(event) reads it back
The bridge between a <form> and a request without serializing anything by hand. It carries files, which JSON cannot, and it preserves the form’s own semantics — a checkbox that is unchecked is absent, a multi-select is repeated — which a naive { …fields } object gets wrong. This site’s uploads (handleFileUpload over the storage adapter) read it on the server; on the client, Object.fromEntries(new FormData(form)) is the one-liner for a plain form and a trap for anything repeated.
A form already knows its own fields. FormData is the API that asks it, instead of reading each input by hand and getting the edge cases wrong.