Skip to content

Instantly share code, notes, and snippets.

View sitetester's full-sized avatar
👋

sitetester

👋
View GitHub Profile
@sitetester
sitetester / file-write-to-new_dir.go
Last active September 7, 2019 11:14
This will create directory (if not exists) and will write a new file to it
resp, _ := http.Get(GoogleUrl)
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
dir := "resources"
if _, err := os.Stat(dir); os.IsNotExist(err) {
os.Mkdir("."+string(filepath.Separator)+dir, 0777)
}