Files
go-storage/README.md

45 lines
793 B
Markdown
Raw Normal View History

2024-10-23 02:36:04 +02:00
# Go Storage
- Local
- S3
- SSH
- FTP
2024-10-23 02:46:31 +02:00
```go
go get github.com/jkaninda/go-storage
```
### Local Storage
```go
localStorage := local.NewStorage(local.Config{
LocalPath: tmpPath,
RemotePath: backupDestination,
})
err = localStorage.Copy(finalFileName)
if err != nil {
log.Fatal("Error copying file, error %v", err)
}
```
### S3 Storage
```go
s3Storage, err := s3.NewStorage(s3.Config{
Endpoint: "",
Bucket: "",
AccessKey: "",
SecretKey: "",
Region: "",
DisableSsl: "",
ForcePathStyle: "",
RemotePath: "",
LocalPath: "",
})
if err != nil {
utils.Fatal("Error creating s3 storage: %s", err)
}
err = s3Storage.Copy(finalFileName)
if err != nil {
utils.Fatal("Error copying file, error %v", err)
}
```