Skip to content
Node: src.pipe(dst)github.com/sahilkhaire/gox/stream

Pipe

Overview

Pipe copies from src to dst until EOF or error. Node: src.pipe(dst)

If you are coming from Node.js, the closest pattern is src.pipe(dst).

Signature

go
func Pipe(src io.Reader, dst io.Writer) (int64, error)

Compare: Node.js · Standard Go · gox

js
src.pipe(dst)
go
io.Copy(dst, src)
// or io.ReadAll(r)
go
import "github.com/sahilkhaire/gox/stream"

stream.Pipe(src, dst)

Example

go
import "github.com/sahilkhaire/gox/stream"

stream.Pipe(src, dst)

Tips

Import github.com/sahilkhaire/gox/stream and call Pipe directly. See the comparison below for the standard library equivalent.

Standard library alternative

Use the standard library directly:

go
io.Copy(dst, src)
// or io.ReadAll(r)

Back to stream package overview

MIT Licensed · Built for Node.js developers moving to Go