Skip to content

How to keep the file info with tar.gz? #47

Closed Answered by tsolomko
nick-delirium asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

The creation date, permissions and other info about files are empty, because when you create a TAR entry for each of the files you don't supply this information, and SWCompression does not make any assumptions about the default values of these properties (partially because a lot of them are optional, at least in the TAR case). Depending on your particular needs you may want to change the body of your for-loop to something like this

let filename = "\(self.lastIndex).jpeg"
var tarEntry = TarContainer.Entry(info: .init(name: filename, type: .regular), data: imageData)
tarEntry.info.permissions = Permissions(rawValue: 420) // This is an example (rw-r--r--), you may want to copy the permis…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nick-delirium
Comment options

Answer selected by nick-delirium
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants