Skip to content

Commit

Permalink
musings on mholt#358
Browse files Browse the repository at this point in the history
  • Loading branch information
Андрей Лухнов committed Apr 29, 2023
1 parent de8cf22 commit edfa06f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fs.go
Expand Up @@ -244,8 +244,8 @@ func (cf compressedFile) Close() error {
// directory tree order.
type ArchiveFS struct {
// set one of these
Path string // path to the archive file on disk, or...
Stream *io.SectionReader // ...stream from which to read archive
Path string // path to the archive file on disk, or...
Stream io.Reader // ...stream from which to read archive

Format Archival // the archive format
Prefix string // optional subdirectory in which to root the fs
Expand Down Expand Up @@ -327,7 +327,7 @@ func (f ArchiveFS) Open(name string) (fs.File, error) {

var inputStream io.Reader = archiveFile
if f.Stream != nil {
inputStream = io.NewSectionReader(f.Stream, 0, f.Stream.Size())
inputStream = f.Stream
}

err = f.Format.Extract(f.context(), inputStream, []string{name}, handler)
Expand Down Expand Up @@ -519,7 +519,7 @@ func (f ArchiveFS) Stat(name string) (fs.FileInfo, error) {
}
var inputStream io.Reader = archiveFile
if f.Stream != nil {
inputStream = io.NewSectionReader(f.Stream, 0, f.Stream.Size())
inputStream = f.Stream
}
err = f.Format.Extract(f.context(), inputStream, []string{name}, handler)
if found {
Expand Down Expand Up @@ -583,7 +583,7 @@ func (f ArchiveFS) ReadDir(name string) ([]fs.DirEntry, error) {

var inputStream io.Reader = archiveFile
if f.Stream != nil {
inputStream = io.NewSectionReader(f.Stream, 0, f.Stream.Size())
inputStream = f.Stream
}

err = f.Format.Extract(f.context(), inputStream, filter, handler)
Expand Down

0 comments on commit edfa06f

Please sign in to comment.