Closed krm35 closed 9 months ago
yep I use it but forgot to implement it https://github.com/uNetworking/uWebSockets.js/issues/529#issuecomment-851046029
@krm35 @uNetworkingAB I debugged big file upload for hours and I noticed you have to copy the chunk, the write it on disk (or whatever stream).
For example, this .slice(0)
from this line writeStream.write(Buffer.from(chunk.slice(0)));
is super important. Otherwise, it won't write anything to the stream.
What is the explanation?
Needs to slice to make a deep copy of the chunk otherwise there is a reference problem
It's always a good idea to read the documentation https://unetworking.github.io/uWebSockets.js/generated/interfaces/HttpResponse.html#onData
const {fileName} = querystring.parse(req.getQuery());
We have res.getQuery("filename") and we also have MultipartParser built-in.