sparkling-media
Media helper APIs for choosing, uploading, downloading, and saving media files from Lynx/JS.
Install
Exports
chooseMedia(params, callback)
Select images or videos from album or camera.
- Request:
- Response:
{ code: number; msg: string; data?: { tempFiles: TempFile[] } }
TempFile:
Example:
uploadFile(params, callback)
Upload a file to a remote server.
- Request:
- Response:
{ code: number; msg: string; data?: { url?: string; uri?: string; response?: object; clientCode?: number } }
Example:
uploadImage(params, callback)
Upload an image to a remote server.
- Request:
- Response:
{ code: number; msg: string; data?: { url?: string; uri?: string; response?: object; clientCode?: number } }
Example:
downloadFile(params, callback)
Download a file from a URL.
- Request:
- Response:
{ code: number; msg: string; data?: { httpCode: number; clientCode: number; header: object; filePath: string } }
Example:
saveDataURL(params, callback)
Save a base64 data URL to the device.
- Request:
- Response:
{ code: number; msg: string; data?: { filePath: string } }
Example:
Native method names
This package calls:
media.chooseMediamedia.uploadFilemedia.uploadImagemedia.downloadFilemedia.saveDataURL
Your host app must register native implementations for these methods. See Sparkling Method SDK / iOS.

