aboutsummaryrefslogtreecommitdiff
path: root/client/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/main.go')
-rw-r--r--client/main.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/client/main.go b/client/main.go
index 5397384..47af004 100644
--- a/client/main.go
+++ b/client/main.go
@@ -6,6 +6,7 @@ import (
"encoding/base64"
"flag"
"fmt"
+ "io"
"net/http"
"os"
"strings"
@@ -116,5 +117,19 @@ func main() {
if err != nil {
panic(err)
}
+ } else if flag.Arg(0) == "get" {
+ user := flag.Arg(1)
+ filename := flag.Arg(2)
+ response, _ := http.Get(servers[0] + "/storage/" + user + "/" + filename)
+ responseBodyBytes, _ := io.ReadAll(response.Body)
+ os.WriteFile(user + "/" + filename, responseBodyBytes, 0644)
+ } else if flag.Arg(0) == "post" {
+ filename := flag.Arg(1)
+ file, _ := os.Open(filename)
+ http.Post(
+ servers[0] + "/storage/" + id + "/" + filename,
+ "application/octet-stream",
+ file,
+ )
}
}