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

    FileSource that reads the outbound file from the Node filesystem.

    Ranges are read on demand through an fs.promises file handle, so large files are streamed rather than loaded into memory. Construct instances with the async NodeFileSource.create factory (which stats the file for its size). Node-only; import from rtcforge-sdk/filetransfer/node.

    Implements

    Index

    Properties

    Methods

    Properties

    mimeType: string

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

    name: string

    File name advertised to the receiver; defaults to the path's basename.

    size: number

    Total file size in bytes, determined by stat at creation.

    Methods

    • Read up to length bytes from offset, opening the file for reading on first use.

      Parameters

      • offset: number

        Byte offset at which to start reading.

      • length: number

        Maximum number of bytes to read; the result is truncated to the bytes actually read at end-of-file.

      Returns Promise<ArrayBuffer>

      The bytes read.

    • Create a source for a file on disk, reading its size via stat.

      Parameters

      • path: string

        Path to the file to send.

      • opts: { mimeType?: string; name?: string } = {}

        Optional overrides: name (advertised file name, defaults to the basename) and mimeType (defaults to application/octet-stream).

      Returns Promise<NodeFileSource>

      A ready-to-use NodeFileSource.