How to compress / archive multiple files into one file?

Can I use the Compression framework to compress / archive multiple files into one file? Compression is not important, I just want to be able to create a single file that can be sent somewhere and extracted into a folder with those files.

If not the Compression framework, what other options do I have? I prefer to use built-in libraries and frameworks to minimize dependencies in my project, and I am find with me writing a lot of code for this.

Accepted Reply

Can I use the Compression framework to compress / archive multiple files into one file?

I’m unfamiliar with “Compression framework”. Is that an Apple thing? Or a third-party thing?

The closest Apple thing that I can think of is

<compression.h>
. If that’s what you’re referring to then, no, it can’t work with archives. The focus of that API is to provide high-quality, high-performance compression and decompression of data streams. The resulting data streams are what you would put inside an archive, like a
.zip
file, but the API won’t help you with that part of the equation.

If you want to work with archives, there isn’t really a good answer. You have various options on macOS, but if your focus is on iOS then you’ll need to write or acquire your own library for this.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

Can I use the Compression framework to compress / archive multiple files into one file?

I’m unfamiliar with “Compression framework”. Is that an Apple thing? Or a third-party thing?

The closest Apple thing that I can think of is

<compression.h>
. If that’s what you’re referring to then, no, it can’t work with archives. The focus of that API is to provide high-quality, high-performance compression and decompression of data streams. The resulting data streams are what you would put inside an archive, like a
.zip
file, but the API won’t help you with that part of the equation.

If you want to work with archives, there isn’t really a good answer. You have various options on macOS, but if your focus is on iOS then you’ll need to write or acquire your own library for this.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks Eskimo, clear answer, now I know what to do.


The reason I spoke about Compression as a framework, is because of this page.

The reason I spoke about Compression as a framework, is because of this page.

Yeah, that’s weird. It seems that the new documentation system labels every top-level API as a framework, even ones that aren’t packaged as a framework but are instead libraries. Personally I find that both grating and potentially misleading, and I’ve filed a bug to see if we can get that changed (r. 48230573).

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"