@not3/sdk
    Preparing search index...

    Class P2PSender

    Sends a single file of any size to a P2PReceiver over a WebRTC data channel, end-to-end encrypted with a seed the server never sees.

    The session outlives a single peer: if the channel dies or a joiner cannot prove it holds the seed, the sender drops that peer and waits for the next one, which lets a receiver re-join and resume from its validated offset. Memory stays bounded — one chunk is read through getBytes at a time and sending pauses whenever the channel's send buffer fills up.

    Index

    Constructors

    • Create a sender for a single file.

      Parameters

      • p2p: P2PClient

        The P2P sub-client of a configured Not3Client.

      • name: string

        The file name announced to the receiver (encrypted on the wire).

      • size: number

        The file size in bytes.

      • Optionalopts: { seed?: string }
        • Optionalseed?: string

          Reuse a seed to restart a broken transfer in a new session.

      Returns P2PSender

    Methods

    • Cancel the transfer, telling a connected peer about it.

      Returns Promise<void>

      A promise resolving once the abort was attempted.

    • Get the seed the file is encrypted with. Needed to build the share link.

      Returns string

      The seed, handle with care.

    • Get the id of the created session.

      Returns string

      The session id.

      Error If the session was not created yet.

    • Create the session and serve the file to whoever joins with the seed.

      Parameters

      Returns Promise<void>

      A promise resolving once a receiver confirmed the full transfer.

      Error If the transfer was already started.