dylex / zip-stream

Haskell ZIP archive streaming processing using conduit
BSD 3-Clause "New" or "Revised" License
7 stars 9 forks source link

Support extended file attributes. #6

Open utdemir opened 6 years ago

utdemir commented 6 years ago

Hey, thank you for creating this library!

I am using this library to create an archive with an executable file in it, however one can not run it directly after unpacking since it doesn't have an executable bit set. Using zip-archive, I can set the executable bit using externalFileAttributes field. I managed to make it work for compressing with this patch: external-file-attrs.patch, however it wasn't straighforward to do the same for unpacking & cmd.

Thanks again.

dylex commented 6 years ago

You're right that there's no real way to do this unzipping at the moment, which is why I hadn't exposed this to begin with. The flags get put at the end of the archive, so if you want to stream results out as you read them, you can't provide this flag.

The only real option here would be to allow streaming of these extra attributes as a second pass at the end. So you'd first get all the files and their data, and then get a second file listing with the central directory attributes, so you could go back and fix them up, for example.

I'm happy to apply this to let you specify the attributes when zipping, if that's useful to you. Beyond that will take a new interface. If the second pass thing seems workable I can look into it.

utdemir commented 6 years ago

Thank you very much, this is indeed very useful for me :).

I am not actually using Unzip at all, so I was only thinking about consistency.

Thanks again.