import { type FileTransferTransport } from "./transport.js"; export interface FileOffer { id: string; name: string; size: number; mime: string; hashAlgo?: string; hashHex?: string; } export type DataEventType = { type: "connected"; connId: number; peer: string; } | { type: "fileOffer"; offer: FileOffer; connId: number; } | { type: "fileCanceled"; id: string; name: string; reason: string; } | { type: "sendPending"; id: string; name: string; size: number; } | { type: "sendAccepted"; id: string; name: string; } | { type: "sendAwaitingAck"; id: string; name: string; } | { type: "sendRejected"; id: string; name: string; reason: string; } | { type: "fileRepairing"; id: string; name: string; missing: number; slowNetwork: boolean; } | { type: "fileProgress"; id: string; received: number; total: number; bytesPerSecond: number; slowNetwork: boolean; } | { type: "fileComplete"; id: string; name: string; blob: Blob; } | { type: "sendProgress"; id: string; name: string; sent: number; total: number; bytesPerSecond: number; slowNetwork: boolean; } | { type: "sendComplete"; id: string; name: string; } | { type: "closed"; reason: string; } | { type: "error"; message: string; }; type DataEventCallback = (event: DataEventType) => void; export declare function onDataEvent(cb: DataEventCallback): void; export declare function setFileTransferTransport(transport: FileTransferTransport | null): void; export declare function getFileTransferTransport(): FileTransferTransport | null; /** Open a data connection to a peer. Resolves only when the dataConnected event fires. * If a connect attempt is already in flight, returns the existing promise. */ export declare function connectData(peerAddress: string): Promise; /** Start listening for incoming data connections at the given address. */ export declare function startDataListening(address: string): Promise; /** Wire up host data events. Call once on boot. */ export declare function initDataEvents(): void; /** Close the data connection. */ export declare function closeData(): Promise; export declare function isConnected(): boolean; export declare function sendFile(file: File): Promise; export declare function acceptFileOffer(id: string): Promise; export declare function rejectFileOffer(id: string, reason?: string): Promise; export declare function cancelFileTransfer(id: string, reason?: string): Promise; export {}; //# sourceMappingURL=file-transfer.d.ts.map