plik zapisu Golang
// write file
write1, _ := os.Create("index.txt")
write1.Write([]byte("hello wordl"))
ioutil.WriteFile("indexx.txt", []byte("hello wordl"), fs.ModePerm)
os.WriteFile("indexxx.txt", []byte("hello wordl"), fs.ModePerm)
write2 := strings.NewReader("hello wordl")
write2.WriteTo(os.Stdout)
write3 := bufio.NewReader(write2)
write3.WriteTo(os.Stdout)
write4 := bufio.NewWriter(os.Stdout)
write4.ReadFrom(write2)
// read file
read1, _ := fs.ReadFile(os.DirFS("."), "index.txt")
fmt.Println(string(read1))
read2, _ := os.ReadFile("index.txt")
fmt.Println(string(read2))
read3, _ := ioutil.ReadFile("index.txt")
fmt.Println(string(read3))
Restu Wahyu Saputra