Is there a way for nodejs’ “net” module to determine if a data packet is the last packet in a sequence?

I’m getting a large amount of json data from a TCP Server. I can successfully connect to the server with nodejs’ “net” module and send the packet to request the data from it. The server sends the data back in packets, of course, so I have a listener which gets the string data from each packet and stores it in a string buffer.

screenshot of described code

The issue is that net’s data event doesn’t offer any indication of whether a packet is the last packet in the sequence or not. In Wireshark, I can clearly see that the last packet is the one with the PSH flag:

screenshot of described wireshark packet

but there’s no way to look at flags or packet details with net, only data.

I looked within the net documentation for other events which might indicate the last packet in the sequence. I tried using the end event, but this was not correct. I took every event in the documentation and put a simple event listener on it to log when it was fired, and the only one which fired at the last packet was the data event. I tried seeing if maybe there were a few extra bytes in the data which contained extra details, but net only returns data. I tried looking into net’s source code, but I’m too inexperienced to figure out the problem from there.

This might be a dumb question, but I’m just too inexperienced with net to figure out how to do this, and every simple tutorial for a TCP client in node js just says that you can listen for data packets with the data event. If nothing else works, I can just look for the packet whose last character is a ‘}’ to indicate the end of the JSON object, but I imagine this could cause bigger issues down the road.