mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
load README.md into preview view
This commit is contained in:
@@ -4,14 +4,22 @@
|
||||
package fileservice
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/wavetermdev/thenextwave/pkg/wavebase"
|
||||
)
|
||||
|
||||
type FileService struct{}
|
||||
|
||||
func (fs *FileService) ReadFile(path string) ([]byte, error) {
|
||||
func (fs *FileService) ReadFile(path string) (string, error) {
|
||||
path = wavebase.ExpandHomeDir(path)
|
||||
return os.ReadFile(path)
|
||||
barr, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("cannot read file %q: %w", path, err)
|
||||
}
|
||||
time.Sleep(2 * time.Second)
|
||||
return base64.StdEncoding.EncodeToString(barr), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user