Closed soubhikchatterjee closed 2 years ago
You have to completely consume file
in one way or another in order to parse the rest of the request.
@mscdex Not sure what you mean by "consume file", can you pls give a code example?
file
is a readable stream. You have to read all of its contents whether you care about them or not in order for the form parsing to complete.
@mscdex So there is no way to get the filename without using the req.busboy.on("file")
event?
Assuming the filename is coming from the file part, then no. If the filename is being transmitted separately from the file part, as a normal field ('field'
event), then obviously yes.
Also FWIW, in general filenames given by a user/client in forms should rarely be used as-is as they could contain a malicious value.
For eg:
This works!
This does not work :(
PS: When i say "does not work", i mean, i just see the console.log happening on "file" event, but console.log does neither happen on "field" event not in "finish" event.
Am I doing something wrong?