Hi! I am looking to implement a function that would ideally leverage the recursive unpacking and decompression this package already does. The function signature would look something like this:
func ReadMember(path string, member string) (io.ReadCloser, error)
Where path would be the path to the source file and member would be the name of the member within the file whose byte stream will be returned in the io.ReadCloser. For now, member would be the filename returned by Siegfried that delimits paths by # when denoting nested files.
For example, given a (contrived) archive:
foo.zip
dir/bar.zip
baz.csv.gz
Calling ReadMember("foo.zip", "foo.zip#dir/bar.zip#baz.csv.gz#baz.csv") would return a io.ReadCloser that would be the decompressed contents of baz.csv.
The use case is to dynamically read out portions of an archive given the semantics of Siegfried.
A more general function that would walk the members of an input, but that would need to be limited to leaves in the hierarchy.
Do you have a suggestion on how to implement this given the components available in this package?
Hi! I am looking to implement a function that would ideally leverage the recursive unpacking and decompression this package already does. The function signature would look something like this:
Where
pathwould be the path to the source file andmemberwould be the name of the member within the file whose byte stream will be returned in theio.ReadCloser. For now,memberwould be thefilenamereturned by Siegfried that delimits paths by#when denoting nested files.For example, given a (contrived) archive:
Calling
ReadMember("foo.zip", "foo.zip#dir/bar.zip#baz.csv.gz#baz.csv")would return aio.ReadCloserthat would be the decompressed contents ofbaz.csv.The use case is to dynamically read out portions of an archive given the semantics of Siegfried.
A more general function that would walk the members of an input, but that would need to be limited to leaves in the hierarchy.
Do you have a suggestion on how to implement this given the components available in this package?