Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Implement Match methods on tar, rar, and zip formats; port tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Nov 7, 2018
1 parent fea250a commit 48dff64
Show file tree
Hide file tree
Showing 6 changed files with 405 additions and 121 deletions.
121 changes: 0 additions & 121 deletions archiver/archive_test.go

This file was deleted.

8 changes: 8 additions & 0 deletions archiver/archive.go → archiver/archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ type Decompressor interface {
Decompress(in io.Reader, out io.Writer) error
}

// Matcher is a type that can return whether the given
// file appears to match the implementation's format.
// Implementations should return the file's read position
// to where it was when the method was called.
type Matcher interface {
Match(*os.File) (bool, error)
}

func fileExists(name string) bool {
_, err := os.Stat(name)
return !os.IsNotExist(err)
Expand Down
Loading

0 comments on commit 48dff64

Please sign in to comment.