zmodem

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package zmodem carries files over a terminal's own byte stream with ZMODEM, as rz and sz on the other end expect: Find spots a transfer the other end started in what it prints, Receive takes the files sz sends, Send gives rz the files it waits for. It draws nothing; the caller asks the user and shows how it goes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Receive

func Receive(ctx context.Context, c xfer.Conn, sink xfer.Sink, o Options) (rest []byte, err error)

Receive takes the files the other end (sz) sends, into sink. It returns what the shell printed after the transfer: the caller shows it.

func Refuse

func Refuse(ctx context.Context, c xfer.Conn) (rest []byte, err error)

Refuse declines an offer the user did not take: it cancels the other end and returns what the shell printed after.

func Send

func Send(ctx context.Context, c xfer.Conn, src xfer.Source, o Options) (rest []byte, err error)

Send gives the other end (rz) src's files; folders are left out, as ZMODEM carries none. It returns what the shell printed after.

Types

type Offer

type Offer struct {
	// Upload says the other end runs rz and waits for files, which we
	// send: it sent ZRINIT. Otherwise it runs sz and sends us files: it
	// sent ZRQINIT.
	Upload bool
}

Offer is a transfer the other end started.

func Find

func Find(p []byte) (at int, o *Offer)

Find reports where in p a transfer starts: the first complete hex ZRQINIT or ZRINIT header in it whose CRC holds, -1 and nil for none.

type Options

type Options struct {
	// EscapeControl escapes every control character both ways, for a
	// line that would not carry them as they are (Telnet, serial).
	EscapeControl bool
	// Progress is told how the files go; nil for nothing.
	Progress xfer.Progress
	// Timeout is how long to wait for the other end before asking again;
	// 0 is 10 seconds.
	Timeout time.Duration
}

Options are how a transfer goes.

Jump to

Keyboard shortcuts

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