25 lines
415 B
Go

package utils
import (
"context"
"io"
"os"
)
func CreateFile(ctx context.Context, filePath string) (io.ReadWriter, error) {
rwFile, err := os.Create(filePath)
if err != nil {
return nil, err
}
return rwFile, nil
}
func OpenFile(ctx context.Context, filePath string) (io.ReadWriter, error) {
file, err := os.OpenFile(filePath, os.O_RDWR, 0644)
if err != nil {
return nil, err
}
return file, nil
}