mirror of
https://github.com/vbatts/tar-split.git
synced 2024-12-19 11:56:30 +00:00
tar/asm: more interface for (dis)assembly
This commit is contained in:
parent
cfd32ecbc4
commit
86bf4b98ea
1 changed files with 29 additions and 0 deletions
|
@ -11,6 +11,16 @@ type FileGetter interface {
|
||||||
Get(string) (io.ReadCloser, error)
|
Get(string) (io.ReadCloser, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FilePutter interface {
|
||||||
|
// Put returns a stream for the provided file path
|
||||||
|
Put(string, io.Writer) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type FileGetPutter interface {
|
||||||
|
FileGetter
|
||||||
|
FilePutter
|
||||||
|
}
|
||||||
|
|
||||||
// NewPathFileGetter returns a FileGetter that is for files relative to path relpath.
|
// NewPathFileGetter returns a FileGetter that is for files relative to path relpath.
|
||||||
func NewPathFileGetter(relpath string) FileGetter {
|
func NewPathFileGetter(relpath string) FileGetter {
|
||||||
return &pathFileGetter{root: relpath}
|
return &pathFileGetter{root: relpath}
|
||||||
|
@ -24,3 +34,22 @@ func (pfg pathFileGetter) Get(filename string) (io.ReadCloser, error) {
|
||||||
// FIXME might should have a check for '../../../../etc/passwd' attempts?
|
// FIXME might should have a check for '../../../../etc/passwd' attempts?
|
||||||
return os.Open(path.Join(pfg.root, filename))
|
return os.Open(path.Join(pfg.root, filename))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type bufferFileGetPutter struct {
|
||||||
|
files map[string][]byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func (bfgp bufferFileGetPutter) Get(name string) (io.ReadCloser, error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
type writeCloserWrapper struct {
|
||||||
|
io.Writer
|
||||||
|
closer func() error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *nopWriteCloser) Close() error { return nil }
|
||||||
|
|
||||||
|
func NewBufferFileGetPutter() FileGetPutter {
|
||||||
|
return &bufferFileGetPutter{}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue