[quote='775908021, southbayjt, /thread/775908, /profile/southbayjt'] Does Network framework have a built-in way to stream those bytes straight from disk as it sends them? [/quote] No. When dealing with a large file like this, you have to adopt a streaming approach. That is: Read a chunk of the file off the disk. Send it to connection. When the send completion handler is called, check whether there’s more data to send. If so, repeat the process from step 1. It’s weird that you’re JSON encoding the data. If you’re dealing with large files, JSON is needlessly inefficient. That doesn’t change the calculus above — you could make the transfer smaller by skipping the encoding but there can always be a file that’s too big — but it does affect your on-the-wire efficiency. You’re transferring one third more bytes than you need to. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic:
Programming Languages
SubTopic:
Swift
Tags: