()
| 33 | } |
| 34 | |
| 35 | func (s FileStream) Data() (io.ReadCloser, error) { |
| 36 | file, err := os.Open(s.path) |
| 37 | if err != nil && errors.Is(err, os.ErrNotExist) { |
| 38 | return nil, fmt.Errorf("File '%s' not found", s.path) |
| 39 | } |
| 40 | if err != nil { |
| 41 | return nil, fmt.Errorf("Error reading file '%s': %w", s.path, err) |
| 42 | } |
| 43 | return file, nil |
| 44 | } |
| 45 | |
| 46 | func NewFileStream(path string) *FileStream { |
| 47 | return &FileStream{ |