How to keep the file info with tar.gz? #47
-
Beta Was this translation helpful? Give feedback.
Answered by
tsolomko
Aug 17, 2023
Replies: 1 comment 1 reply
-
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 permissions of the original file.
// ... Set other properties in tarEntry.info ...
entries.append(tarEntry)
self.lastIndex+=1 The list of available properties in |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
nick-delirium
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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