Copy
Overview
Copy copies src to dst (fs.promises.copyFile).
If you are coming from Node.js, the closest pattern is fs.copyFile(src, dst).
Signature
go
func Copy(ctx context.Context, src, dst string) errorCompare: Node.js · Standard Go · gox
js
fs.copyFile(src, dst)go
// os / io helpers — e.g. os.copygo
import "github.com/sahilkhaire/gox/fs"
fs.Copy(ctx, src, dst)Example
go
import "github.com/sahilkhaire/gox/fs"
fs.Copy(ctx, src, dst)Tips
Pass context.Context as the first argument so cancellation and deadlines propagate correctly.
Standard library alternative
Use os.ReadFile, os.WriteFile, etc. Pass context.Context manually for cancellation.