1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
package instancewriter
import (
"io"
"os"
)
// InstanceRawWriter provides an InstanceWriter implementation that copies the contents of a file to another.
type InstanceRawWriter struct {
rawWriter io.WriteCloser
}
// NewInstanceRawWriter returns an InstanceRawWriter for the provided target file.
func NewInstanceRawWriter(writer io.WriteCloser) *InstanceRawWriter {
return &InstanceRawWriter{rawWriter: writer}
}
// ResetHardLinkMap is a no-op.
func (crw *InstanceRawWriter) ResetHardLinkMap() {}
// WriteFile is a no-op.
func (crw *InstanceRawWriter) WriteFile(name string, srcPath string, fi os.FileInfo, ignoreGrowth bool) error {
return nil
}
// WriteFileFromReader streams a file into the target file.
func (crw *InstanceRawWriter) WriteFileFromReader(src io.Reader, fi os.FileInfo) error {
_, err := io.CopyN(crw.rawWriter, src, fi.Size())
return err
}
|