sparkling-media
v2.0.1
Published
Sparkling media methods for choosing, uploading, and downloading media files
Readme
sparkling-media
Media handling methods for Sparkling applications, enabling image/video selection, upload, and download.
Installation
npm install sparkling-media@latestAfter installing, run sparkling-app-cli autolink to automatically link the native modules:
npx sparkling autolinkUsage
import { chooseMedia, uploadFile, downloadFile } from 'sparkling-media';
// Select media from album
chooseMedia({
mediaTypes: ['image'],
sourceType: 'album',
maxCount: 9,
}, (result) => {
console.log(result.data?.tempFiles);
});
// Upload file
uploadFile({
url: 'https://api.example.com/upload',
filePath: '/path/to/file.jpg',
}, (result) => {
console.log(result);
});
// Download file
downloadFile({
url: 'https://example.com/image.png',
extension: 'png',
}, (result) => {
console.log(result.data?.filePath);
});Documentation
- API Reference - Detailed API documentation, parameters, and response formats
- Manual Installation - Fallback installation if autolink fails
