@fnlb-project/stanza
Version:
Modern XMPP in the browser, with a JSON API
43 lines (42 loc) • 1.46 kB
TypeScript
import { EventEmitter } from 'events';
import * as Hashes from '../platform';
import { FileDescription, Hash as ProtocolHash, Jingle } from '../protocol';
import ICESession, { ICESessionOpts } from './ICESession';
import { ActionCallback } from './Session';
export declare class Sender extends EventEmitter {
file?: File;
channel?: RTCDataChannel;
hash: typeof Hashes.Hash;
private config;
constructor(opts?: {});
send(file: File, channel: RTCDataChannel): void;
}
interface ReceiverMetadata extends FileDescription {
actualhash?: string;
hash?: ProtocolHash;
}
export declare class Receiver extends EventEmitter {
metadata: ReceiverMetadata;
private config;
private receiveBuffer;
private received;
private channel?;
private hash;
constructor(opts?: {});
receive(metadata: ReceiverMetadata, channel: RTCDataChannel): void;
}
export default class FileTransferSession extends ICESession {
private sender?;
private receiver?;
private file?;
private receivedFile?;
private channel?;
private contentName?;
constructor(opts: ICESessionOpts);
start(file?: File | ActionCallback, next?: ActionCallback): Promise<void>;
accept(next?: ActionCallback): Promise<void>;
protected onSessionInitiate(changes: Jingle, cb: ActionCallback): Promise<void>;
protected onSessionInfo(changes: Jingle, cb: ActionCallback): void;
private _maybeReceivedFile;
}
export {};