File transfer over xBee

I am looking for a script that demonstrates transferring a basic text file over xbee and storing it to SD. I have started programming some lines and I am seeing a huge challenge here working with ram and the order of packets arriving.

What is sending the file? Are you using the XBee library, or simple AT mode?

The XBee should handle putting the packets it gets on the serial port in the correct order, if you are using AT mode, so that shouldn't be a concern.