We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please answer these questions before submitting your issue. Thanks!
go version
1.9.2
I don't know.
go env
windows/amd64,
I was have a text file with size 6.79 GB. Then i read it with code :-
f, err := os.Open("filepath") checkErr(err) // get the file size stat, err := f.Stat() checkErr(err) buf := make([]byte, stat.Size()) fmt.Println(stat.Size()) f.Read(buf)
Finally i need to write the buffer as a new file with this code :-
ioutil.WriteFile("temp.csv", []byte(buf), 0644)
I expect the new written file will the same size as the file i was read which size is 6.79GB.
The new written file size was 2.79GB.
The text was updated successfully, but these errors were encountered:
It's not obvious that you're checking all your errors. I don't see error checks from your ioutil.WriteFile.
Oh, and you're also not using io.Reader correctly. See the docs on the https://golang.org/pkg/io/#Reader
For questions about Go, see https://golang.org/wiki/Questions.
Sorry, something went wrong.
No branches or pull requests
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.9.2
Does this issue reproduce with the latest release?
I don't know.
What operating system and processor architecture are you using (
go env
)?windows/amd64,
What did you do?
I was have a text file with size 6.79 GB. Then i read it with code :-
f, err := os.Open("filepath")
checkErr(err)
// get the file size
stat, err := f.Stat()
checkErr(err)
buf := make([]byte, stat.Size())
fmt.Println(stat.Size())
f.Read(buf)
Finally i need to write the buffer as a new file with this code :-
ioutil.WriteFile("temp.csv", []byte(buf), 0644)
What did you expect to see?
I expect the new written file will the same size as the file i was read which size is 6.79GB.
What did you see instead?
The new written file size was 2.79GB.
The text was updated successfully, but these errors were encountered: