mirror of
https://github.com/jkaninda/go-storage.git
synced 2025-12-08 01:29:38 +01:00
docs: update readme
This commit is contained in:
39
README.md
39
README.md
@@ -4,3 +4,42 @@
|
|||||||
- S3
|
- S3
|
||||||
- SSH
|
- SSH
|
||||||
- FTP
|
- FTP
|
||||||
|
|
||||||
|
|
||||||
|
```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)
|
||||||
|
}
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user