> ## Documentation Index
> Fetch the complete documentation index at: https://www.offlineprotocol.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These docs target Mesh SDK v0.27.0. Match the installed package and binding before generating code. Start at /getting-started/agents for task-specific reading paths.
> Call the company and product Offline Protocol, never Offline alone. Current packages: @offline-protocol/mesh-sdk 0.27.0 (React Native), @offline-protocol/id-react 0.2.0, @offline-protocol/id-react-native 0.3.3, @offline-protocol/pol 0.1.2 and @offline-protocol/cli 0.2.6. Canonical docs URLs start with https://www.offlineprotocol.com/docs.
> The Mesh SDK runs in a native app or gateway. A browser OfflineID SDK integration does not provide browser mesh transport. Local mesh operation does not require a portal API key.
> Service RPC is signed plaintext in v0.27.0. Message delivery, durable local acceptance and backend commit are distinct outcomes. Use the workflow guide for the required application logic.
> Offline Protocol CLI 0.2.6 is on npm (@offline-protocol/cli, command offline). Its local MCP server runs with offline mcp serve and requires no login or key. Hosted MCP is at https://mcp.offlineprotocol.com/mcp with an application API key in Authorization: Bearer and a matching x-app-id; organization keys are rejected. Follow /tools/overview for setup and do not invent commands beyond it. MCP provides integration context and planning, not mesh execution; file-writing tools are local only.
> Phone Wi-Fi Direct and MultipeerConnectivity carry no data in v0.27.0. Use BLE or a provisioned relay. The receiver core ACKs before application persistence; use application acceptance for durable workflows.
> Proof of Location is Sepolia testnet witness evidence, not zero-knowledge proof or proof of presence. The geohash is public onchain. Read /proof-of-location/security before integration.

# Files and media

> Mesh SDK v0.27.0 file transfer methods: send files, images, voice and video notes, inspect transfer progress and cancel a transfer.

Import `OfflineProtocol` from `@offline-protocol/mesh-sdk`. These signatures match **v0.27.0**. Read [the integration guide](/docs/mesh-sdk/setup-rn) for prerequisites and complete usage.

## Methods on this page

* [`sendMedia`](#sendmedia)
* [`sendFile`](#sendfile)
* [`sendImage`](#sendimage)
* [`sendVoiceNote`](#sendvoicenote)
* [`sendVideoNote`](#sendvideonote)
* [`sendVideo`](#sendvideo)
* [`getFileProgress`](#getfileprogress)
* [`cancelFileTransfer`](#cancelfiletransfer)
* [`processFileChunk`](#processfilechunk)
* [`finalizeFile`](#finalizefile)

## 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

```typescript theme={null}
sendMedia(params: SendMediaParams): Promise<string>
```

## sendFile

Sends a generic file to a recipient (convenience for sendMedia with ContentType.File).

**returns:** File ID for tracking progress

```typescript theme={null}
sendFile(params: SendFileParams): Promise<string>
```

## sendImage

Sends an image to a recipient.

**returns:** File ID for tracking progress

```typescript theme={null}
sendImage(recipient: string, fileData: string, fileName: string, metadata?: MediaMetadata): Promise<string>
```

## sendVoiceNote

Sends a voice note to a recipient.

**returns:** File ID for tracking progress

```typescript theme={null}
sendVoiceNote(recipient: string, fileData: string, fileName: string, metadata?: MediaMetadata): Promise<string>
```

## sendVideoNote

Sends a video note to a recipient.

**returns:** File ID for tracking progress

```typescript theme={null}
sendVideoNote(recipient: string, fileData: string, fileName: string, metadata?: MediaMetadata): Promise<string>
```

## sendVideo

Sends a video to a recipient.

**returns:** File ID for tracking progress

```typescript theme={null}
sendVideo(recipient: string, fileData: string, fileName: string, metadata?: MediaMetadata): Promise<string>
```

## getFileProgress

Gets the progress of a file transfer

**returns:** File progress information, or null if not found

```typescript theme={null}
getFileProgress(fileId: string): Promise<FileProgress | null>
```

## cancelFileTransfer

Cancels an active file transfer

**returns:** True if cancelled, false if not found

```typescript theme={null}
cancelFileTransfer(fileId: string): Promise<boolean>
```

## processFileChunk

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

```typescript theme={null}
processFileChunk(fileId: string, chunkIndex: number, totalChunks: number, fileSize: number, fileName: string, fileChecksum: string, data: number[]): Promise<void>
```

## finalizeFile

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

```typescript theme={null}
finalizeFile(fileId: string): Promise<void>
```

## Parameter and result types

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

### SendMediaParams

```typescript theme={null}
export interface SendMediaParams {
  recipient: string;
  fileData: string;
  fileName: string;
  contentType: ContentType;
  mediaMetadata?: MediaMetadata;
  caption?: string;
  replyToMsg?: string;
  replyContext?: ReplyContext;
  forwardInfo?: ForwardInfo;
  fileId?: string;
}
```

### ContentType

```typescript theme={null}
export enum ContentType {
  Text = 'text',
  Image = 'image',
  Video = 'video',
  Audio = 'audio',
  VoiceNote = 'voice_note',
  VideoNote = 'video_note',
  File = 'file',
  FileChunk = 'file_chunk',
  Poll = 'poll',
}
```

### MediaMetadata

```typescript theme={null}
export interface MediaMetadata {
  mimeType: string;
  fileName: string;
  fileSize: number;
  durationMs?: number;
  width?: number;
  height?: number;
  thumbnailBase64?: string;
  mediaId?: string;
  downloadUrl?: string;
  thumbnailUrl?: string;
  encryptionKey?: string;
  iv?: string;
  ciphertextHash?: string;
  stickerProvider?: string;
  stickerRemoteId?: string;
  stickerKind?: string;
}
```

### ReplyContext

```typescript theme={null}
export interface ReplyContext {
  sender: string;
  text: string;
  timestamp?: number;
  reply_media_label?: string;
  reply_content_type?: string;
}
```

### ForwardInfo

```typescript theme={null}
export interface ForwardInfo {
  original_sender: string;
  original_message_id: string;
  original_timestamp: number;
  forward_count: number;
}
```

### SendFileParams

```typescript theme={null}
export interface SendFileParams {
  recipient: string;
  fileData: string;
  fileName: string;
}
```

### FileProgress

```typescript theme={null}
export interface FileProgress {
  file_id: string;
  chunks_sent: number;
  total_chunks: number;
  percentage: number;
}
```

## Related references

* [Event payloads](/docs/mesh-sdk/events)
* [Configuration types](/docs/mesh-sdk/configuration-types)
* [All public types](/docs/mesh-sdk/public-types)
* [Error codes](/docs/mesh-sdk/errors)
* [All API tasks](/docs/mesh-sdk/reference)
