mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-07 02:38:10 -05:00
17 lines
229 B
Go
17 lines
229 B
Go
package io
|
|
|
|
func Pipe(reader Reader, writer Writer) error {
|
|
for {
|
|
buffer, err := reader.Read()
|
|
if buffer.Len() > 0 {
|
|
err = writer.Write(buffer)
|
|
} else {
|
|
buffer.Release()
|
|
}
|
|
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
}
|
|
}
|