chore(app): migrate from ioutil to io

This commit is contained in:
Vadim Aleksandrov 2024-07-15 16:28:11 +03:00
parent f6338abfd1
commit ce6189685a
No known key found for this signature in database
GPG Key ID: 4D3A2E248D54FDAE

View File

@ -2,7 +2,7 @@ package main
import (
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"os"
@ -36,12 +36,12 @@ func uploadFile(w http.ResponseWriter, r *http.Request) {
}
defer file.Close()
fileBytes, err := ioutil.ReadAll(file)
fileBytes, err := io.ReadAll(file)
if err != nil {
log.Fatalf("Error reading file %v", err)
}
ioutil.WriteFile(config.ImagePath, fileBytes, os.FileMode(0600))
os.WriteFile(config.ImagePath, fileBytes, os.FileMode(0600))
log.Println(aurora.Cyan("Successfully Uploaded File"))
fmt.Fprintf(w, "Successfully Uploaded File\n")