I am looking to send a file from a Jetson Xavier NX (arm linux development board for those who aren't acquainted) to a Raspberry pi Zero via USB, through the standard usb connectors. I want the raspi to receive the input as a file and store it in a directory that will later be scanned and manipulated with python.
I imagine I can send the file with something along the lines of (shell command)
cp /home/pi/file.pkl /dev/ttyAMA0
or (python code)
import serial
s = serial.Serial("/dev/ttyAMA0")
s.write(open("file.pkl","rb").read())
But I'm unsure what would be the best way to read the file in from the pi. I know of the python serial.read() and serial.readline(), but is there anyway to simply read the entire contents that have been sent and interpret it as a file? Can I achieve this by using the cp or cat command in some way?
Thanks in advance