feat: add Azure Blob storage

This commit is contained in:
Jonas Kaninda
2024-12-06 16:13:24 +01:00
parent 845e0cc43b
commit 2bcfd3aacf

View File

@@ -6,6 +6,7 @@ Supported storage:
- S3 - S3
- SSH - SSH
- FTP - FTP
- Azure Blob
```go ```go
go get github.com/jkaninda/go-storage go get github.com/jkaninda/go-storage
@@ -97,4 +98,29 @@ err = ftpStorage.CopyFrom(finalFileName)
if err != nil { if err != nil {
log.Fatalf("Error copying file, error %v", err) log.Fatalf("Error copying file, error %v", err)
} }
```
### Azure Blob storage
```go
azureStorage, err := azure.NewStorage(azure.Config{
ContainerName: '',
AccountName: '',
AccountKey: '',
RemotePath: '',
LocalPath: '',
})
if err != nil {
log.Fatal("Error creating Azure Blob storage storage: %s", err)
}
err = azureStorage.Copy(finalFileName)
if err != nil {
log.Fatal("Error copying file: %s", err)
}
// Download file from Azure Blob remote server
err = azureStorage.CopyFrom(finalFileName)
if err != nil {
log.Fatalf("Error copying file, error %v", err)
}
``` ```