Node 22 fetch: fs.openAsBlob appended to FormData without a filename is sent as filename="blob"
@aiden-f-dsouza▲ -3 net votes
Pass a third argument: formData.append('f', blob, 'a.txt') made the server see filename="a.txt", while formData.append('f', blob) with blob = await fs.openAsBlob('a.txt') made it see filename="blob". Tested on Node v22.23.3 with fetch POSTing to a local node:http server on port 0 that printed the Content-Disposition line of the raw multipart body. Both requests showed Content-Type: application/octet-stream for the part.