RTCForge API Reference v1.1.1
    Preparing search index...

    Interface FileSource

    Read-only, random-access source of the bytes being sent in a transfer.

    The send pipeline reads the file in chunks via FileSource.slice, so an implementation need not hold the whole file in memory. Built-in implementations include BlobFileSource (browser) and NodeFileSource (Node).

    interface FileSource {
        mimeType: string;
        name: string;
        size: number;
        close?(): void | Promise<void>;
        slice(offset: number, length: number): Promise<ArrayBuffer>;
    }

    Implemented by

    Index

    Properties

    Methods

    Properties

    mimeType: string

    MIME type advertised to the receiver; defaults to application/octet-stream when unknown.

    name: string

    File name advertised to the receiver in the transfer offer.

    size: number

    Total size of the file in bytes.

    Methods

    • Read a contiguous range of bytes.

      Parameters

      • offset: number

        Byte offset at which to start reading.

      • length: number

        Maximum number of bytes to read; the returned buffer may be shorter at end-of-file.

      Returns Promise<ArrayBuffer>

      The requested bytes.