zmodem

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 11 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 实现交互 SSH 使用的 ZMODEM 文件收发,不依赖外部命令。

Index

Constants

This section is empty.

Variables

View Source
var ErrCancelled = errors.New("transfer cancelled")

Functions

func Cancel

func Cancel(out io.Writer) error

Cancel 要求远端结束协议,避免把本地后续键盘输入当成文件数据。

func InitialHeader

func InitialHeader(data []byte) (upload bool, ok bool)

InitialHeader 只接受完整且 CRC 有效的标准起始帧;相似文本不吞掉。

func Receive

func Receive(in io.ByteReader, out io.Writer, options ReceiveOptions) error

Receive 在调用方已消费 ZRQINIT 起始帧后接收一批文件。

func ReceiverWindow

func ReceiverWindow(data []byte) int

ReceiverWindow 读取 rz 声明的接收缓冲;零表示可流式接收。

func Send

func Send(in io.ByteReader, out io.Writer, file Upload, options SendOptions) (bool, error)

Send 在调用方已消费 ZRINIT 起始帧后上传一个用户明确选择的普通文件。

Types

type Download

type Download struct {
	Write func([]byte) error
	Close func(complete bool) error
}

Download 由调用方决定路径、缓冲和完成时的同步保存。

type ReceiveOptions

type ReceiveOptions struct {
	Open     func(name string, size int64) (Download, error)
	Progress func(name string, size, transferred int64, complete bool)
}

type SendOptions

type SendOptions struct {
	Progress   func(name string, size, transferred int64, complete bool)
	WindowSize int
}

type Upload

type Upload struct {
	Name   string
	Size   int64
	Reader io.ReadSeeker
}

Jump to

Keyboard shortcuts

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