How can I write/read a file by taking the advantage of linux writev/readv in golang?

60 views
Skip to first unread message

yihao yang

unread,
Aug 16, 2017, 10:01:17 PM8/16/17
to golang-nuts
Hi,

I want to take advantage of writev when writing a file. But I didn't find the interface that accepts a [][]byte parameter.
What can I do?

Thanks,
Yihao

Ian Lance Taylor

unread,
Aug 16, 2017, 11:46:43 PM8/16/17
to yihao yang, golang-nuts
On Wed, Aug 16, 2017 at 7:01 PM, yihao yang <yangyi...@gmail.com> wrote:
>
> I want to take advantage of writev when writing a file. But I didn't find
> the interface that accepts a [][]byte parameter.
> What can I do?

At present we only support writev to network sockets. You can use it
by converting a [][]byte to net.Buffers and calling the WriteTo
method.

Ian
Reply all
Reply to author
Forward
0 new messages