输入输出
读写文件的操作是放在os包里的,Create、Open等方法。返回File*类型,这个类型可以作为Reader和Writer。因此如果把一个文件复制到另一个文件可以这么写
io.Copy(w, r)
http
net/http包
resp, err = http.Get("http://hello.com/index.html")
resp.Body是一个Reader
读写文件的操作是放在os包里的,Create、Open等方法。返回File*类型,这个类型可以作为Reader和Writer。因此如果把一个文件复制到另一个文件可以这么写
io.Copy(w, r)
net/http包
resp, err = http.Get("http://hello.com/index.html")
resp.Body是一个Reader