Skip to main content
This feature is still in our final beta round. If you’d like to get access to it as a beta tester, please send us an email at offlinemode@despia.com
Cache remote files locally for offline access. Background downloads continue when users close the app.
Local CDN uses native OS background transfer APIs (NSURLSession on iOS, WorkManager on Android) with built-in retry. Start a download, close the app, get notified when ready.

Installation


API Reference

Write

Download and cache a remote file. Fire-and-forget - do not await.
Do not await the write call with a key. The JS bridge has a ~30s timeout. Large files will cause it to resolve with null even though the download continues silently. Use contentServerChange callback instead.
string
required
Remote file URL to download
string
required
Local path: folder/subfolder/filename
string
required
Unique ID for this file
boolean
Set to true to show push notification on completion
string
Notification message (wrap in quotes)
If you need more control, you can poll via localcdn://read to check download status instead of relying solely on the callback.

Read

Get metadata for cached files.
array
Array of cached file objects

Delete

Remove cached files.

contentServerChange Callback

Called by native runtime when a download completes. This is where you get the file data.
When it fires:
  • When download completes (could be seconds or minutes later)
  • When app reopens after background downloads completed

Response Schema

string
Full file path (e.g., videos/samples/bigbunny.mp4)
string
Your unique identifier
string
File extension (mp4, mp3, json)
string
Absolute device path
string
Use this for playback - localhost URL
string
Original remote URL
string
File size in bytes
string
Cache status ("cached")
string
Unix timestamp

Background Downloads

Downloads continue when users close the app. Native OS handles retry on network failure.
1

App reopens

Native finds pending items
2

Callback replayed

Calls contentServerChange(item) for each completed download

Playback

Use local_cdn URL for offline playback:

HTTP Upload API

Only available when your app is served via Despia Local Server (not from origin/remote server).
Upload user files via HTTP POST:

React Hook


Environment Check


Test Videos

Free sample videos for testing Local CDN (CC licensed):

Available Test Videos