Chunk upload for iOS, Android, and web
npm install capacitor-chunk-upload
npx cap sync
echo(...)
uploadFile(...)
addListener('uploadStarted', ...)
addListener('uploadProgressChanged', ...)
removeAllListeners()
- Interfaces
echo(options: { value: string; }) => Promise<{ value: string; }>
Param | Type |
---|---|
options |
{ value: string; } |
Returns: Promise<{ value: string; }>
uploadFile(options: UploadOptions) => Promise<void>
Upload a file via chunk
Param | Type |
---|---|
options |
UploadOptions |
addListener(eventName: 'uploadStarted', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listens for event: upload started
Param | Type |
---|---|
eventName |
'uploadStarted' |
listenerFunc |
() => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'uploadProgressChanged', listenerFunc: (progress: { percentage: number; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listens for event: upload progress changed
Param | Type |
---|---|
eventName |
'uploadProgressChanged' |
listenerFunc |
(progress: { percentage: number; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
removeAllListeners() => Promise<void>
Removes all listeners
Upload option
Prop | Type | Description |
---|---|---|
url |
string |
The URL to upload to |
blob |
Blob |
The file to upload. Only available on Web. |
path |
string |
The path of the file to upload. Only available on Android and iOS. |
headers |
{ [key: string]: string; } |
Addition headers to send with the request |
Prop | Type |
---|---|
remove |
() => Promise<void> |