24 lines
404 B
Go
Raw Normal View History

2024-12-10 15:54:22 +01:00
package utils
import (
"context"
"io"
"os"
)
func CreateFile(ctx context.Context, filePath string) (io.Writer, error) {
file, err := os.Create(filePath)
if err != nil {
return nil, err
}
return file, nil
}
func OpenFile(ctx context.Context, filePath string) (io.Reader, error) {
file, err := os.OpenFile(filePath, os.O_RDONLY, 0644)
if err != nil {
return nil, err
}
return file, nil
}