A few weeks ago someone here was asking about code for reading and writing MIME multipart format. It turned out I needed this too, so I implemented some classes to do the job. They handle streaming of large bodies, so you can upload and download large files without taking up much RAM.
They’re part of my TouchDB project, not a standalone framework, so they’ll take a little bit of work to adapt into your code, but not too much. The git repo is here: https://github.com/couchbaselabs/TouchDB-iOS Source files: https://github.com/couchbaselabs/TouchDB-iOS/tree/master/Source The relevant classes are TDMultipartDownloader (for downloads) TDMultipartReader (for uploads) TDMultiInputStream (base class of TDMultipartReader) TDMultipartReader is a subclass of NSInputStream, which may seem weird for something that uploads, but that’s because it’s meant to be connected to NSURLRequest.HTTPBodyStream. It makes sense if you think of the NSURLConnection reading the bytes from the stream and transmitting them over HTTP. FYI, if you want to use any kind of custom NSInputStream subclass with HTTPBodyStream, you’ll run into some frustrating CFNetwork bugs. I figured out how to work around them and TDMultiInputStream shows how. All of this is Apache 2 licensed (very liberal). You’re welcome :) —Jens _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com