Working with the io package
The obvious place to start with IO is, well, the io package (https://golang.org/pkg/io). As we have already seen, the io package defines input and output primitives as the io.Reader and io.Writer interfaces. The following table summarizes additional functions and types, available in the io package, that facilitate streaming IO operations.
|
Function |
Description |
|
|
The data := strings.NewReader("Write me down.")
file, _ := os.Create("./iocopy.data")
io.Copy(file, data)
golang.fyi/ch10/iocopy.go |
|
|
The |