transfer

package
v0.5.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadFile

func ReadFile(r io.Reader, destDir string, progress func(int64, int64)) (string, error)

ReadFile reads FILE_START, FILE_CHUNK..., FILE_END frames from r into destDir. progress is called after each chunk. Returns the path of the written file.

func ReadFrame

func ReadFrame(r io.Reader) (proto.Frame, error)

ReadFrame reads one Frame from r.

func WriteFile

func WriteFile(srcPath, from, transferID string, w io.Writer, progress func(int64, int64)) error

WriteFile sends FILE_START, FILE_CHUNK..., FILE_END frames to w. progress, if non-nil, is invoked after each chunk with (sentBytes, totalBytes). transferID is echoed in FILE_START so the receiver can ACK against the same id.

func WriteFrame

func WriteFrame(w io.Writer, f proto.Frame) error

WriteFrame encodes a Frame as: [4-byte big-endian length][JSON payload]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL