You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling Extractor's Archive() function is convenient due to the format auto-detection (allowing the calling application to treat files as generic archives and have this module figured out the details) however, the behaviour of the function is different depending on the file type.
In particular with compression-only formats don't call the rename function, and the location parameter has to be a file path (vs. a directory path). It would be very handy to make the use of Archive() as consistent as possible. One way may be to add the call to the rename function to the compression-only format functions (e.g. func (e *Extractor) Gz/Bz2/etc...):
ifrename!=nil {
location=rename(location)
}
This gives the caller an opportunity to detect the compression case in the rename function (comparing the old name to location provided to the Archive() call) and provide a destination path for the uncompressed file.
I admit this proposal isn't super elegant. It may be worth checking if existing public dependents are calling Archive() for compression-only formats and providing a non-nil renamer. If not, then it the proposal probably wouldn't break anything. I would also be happy to co-design a new API to make this use case less complicated.
The text was updated successfully, but these errors were encountered:
Calling
Extractor
'sArchive()
function is convenient due to the format auto-detection (allowing the calling application to treat files as generic archives and have this module figured out the details) however, the behaviour of the function is different depending on the file type.In particular with compression-only formats don't call the rename function, and the location parameter has to be a file path (vs. a directory path). It would be very handy to make the use of
Archive()
as consistent as possible. One way may be to add the call to the rename function to the compression-only format functions (e.g.func (e *Extractor) Gz/Bz2/etc...
):This gives the caller an opportunity to detect the compression case in the rename function (comparing the old name to location provided to the
Archive()
call) and provide a destination path for the uncompressed file.I admit this proposal isn't super elegant. It may be worth checking if existing public dependents are calling
Archive()
for compression-only formats and providing a non-nil renamer. If not, then it the proposal probably wouldn't break anything. I would also be happy to co-design a new API to make this use case less complicated.The text was updated successfully, but these errors were encountered: