Fix File Upload in Node.js (#26700)

Summary:
Use the Blob constructor + append with filename instead of File
constructor. Node.js doesn't expose a global File constructor but does
support it in this form.

Queue fields until we get the 'end' event from the previous file. We
rely on previous files being available by the time a field is resolved.
However, since the 'end' event in Readable is fired after two
micro-tasks, these are not resolved in order.

I use a queue of the fields while we're still waiting on files to
finish. This still doesn't resolve files and fields in order relative to
each other but that doesn't matter for our usage.

DiffTrain build for commit https://github.com/facebook/react/commit/a21d1475ffd7225a463f2d0c0c9b732c8dd795eb.

Changelog: [Internal]

Reviewed By: poteto

Differential Revision: D45238341

fbshipit-source-id: d4ce8cf0201a231263c753989267e85f92908b9e
This commit is contained in:
sebmarkbage
2023-04-25 11:43:52 -07:00
committed by Facebook GitHub Bot
parent 9d980ab251
commit 7b39531bc1
@@ -1 +1 @@
36e4cbe2e918ec9c8a7abbfda28898c835361fb2
a21d1475ffd7225a463f2d0c0c9b732c8dd795eb