os.Write fmt.Fprintln ioutil.WriteFile bufio.Write

I know

ioutil.WriteFile - Is non-buffered
bufio.Write - Is buffered

But are os.Write and fmt.Fprintln are buffered or not ?

And similarly, there are os.WriteString, and and others I may be missing here.

Which ones are buffered, and which ones are not?

Also, as Go suggests,

“There’s only one way to do one thing”

Why are there redundant functions to do the same thing (other than buffered bufio and unbuffered ioutil) ?

1 Like

Whether those functions are buffered or not, depends on the io.Reader/io.Buffer you pass in.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.