Skip to main content
Import OfflineProtocol from @offline-protocol/mesh-sdk. These signatures match v0.33.0. Read the integration guide for prerequisites and complete usage.

Methods on this page

sendMedia

Sends a media attachment (image, video, audio, file, etc.) to a recipient. The platform reads the file and passes the raw bytes as a base64 string. The SDK chunks the data and sends each chunk via internet-preferred transport. returns: File ID for tracking progress

sendFile

Sends a generic file to a recipient (convenience for sendMedia with ContentType.File). returns: File ID for tracking progress

sendFileFromPath

Sends a file to a recipient by filesystem path. The SDK’s Rust core opens and reads the file, so the payload never crosses the JS/native bridge as a base64 string. Prefer it over sendFile for anything over a few megabytes: on constrained Android devices the base64 crossing is what runs out of memory. The file is read whole into the Rust heap and chunked there (about twice its size while chunking); it is not streamed. filePath may be a plain path or a file:// URI. A content:// URI is refused: copy the content to a file first. The content type is always ContentType.File. Callers that need image/video/audio typing with a filesystem-path source can either keep using sendMedia (which still accepts base64) or request a typed variant. returns: File ID for tracking progress throws: InvalidArgument if the path is missing, unreadable, not a regular file, or over the 100 MiB transfer limit. Each is refused before a byte is read.

sendImage

Sends an image to a recipient. returns: File ID for tracking progress

sendVoiceNote

Sends a voice note to a recipient. returns: File ID for tracking progress

sendVideoNote

Sends a video note to a recipient. returns: File ID for tracking progress

sendVideo

Sends a video to a recipient. returns: File ID for tracking progress

getFileProgress

Gets the progress of a file transfer returns: File progress information, or null if not found

cancelFileTransfer

Cancels an active file transfer returns: True if cancelled, false if not found

processFileChunk

Processes a file chunk. Use this for custom file transfer handling.

finalizeFile

Finalizes a file transfer. Call this after all chunks have been processed.

Parameter and result types

Import these types from the same SDK package. Event payloads and configuration types are linked below.

SendMediaParams

ContentType

MediaMetadata

ReplyContext

ForwardInfo

SendFileParams

SendFileFromPathParams

FileProgress