Luau Bindings — xfer

The require("xfer") script API — X/Y/Zmodem-style file transfer over any byte-stream: a TCP socket, a gossip peer, or a Telnet-wrapped BBS connection. Every function is [antos]. Design & native core: antos_xfer.

local xfer = require("xfer")
local conn = xfer.tcp(sock)                 -- sock from net.connect
xfer.send(conn, "D:/rom.bin")
xfer.close(conn)

Connections

A transfer runs over a connection object that wraps some underlying stream:

Function Behaviour
xfer.tcp(sock) Wrap a TCP socket (from net.connect).
xfer.gossip(node_id) A gossip peer, by node-ID hex prefix.
xfer.telnet(conn) Wrap a connection with Telnet IAC stripping (for BBS TCP links).
xfer.close(conn) Close a connection.

Transfer

Function Behaviour
xfer.detect(conn) Sense the protocol / direction the peer is offering.
xfer.send(conn, path) Send a file.
xfer.send_batch(conn, paths) Send several files in one session.
xfer.recv(conn [, dest]) Receive into a folder.
xfer.cancel(conn) Abort an in-progress transfer.
xfer.strerror(code) Human-readable message for an error code.

The point of xfer is that the protocol is separate from the pipe — the same Zmodem send works whether the bytes travel over TCP, over the gossip mesh, or through a BBS session.

Related

Important: The Ant64 family of home computers are at early design/prototype stage, everything you see here is subject to change.