1.0.0 • Published 1 year ago
capacitor-chunk-upload v1.0.0
capacitor-chunk-upload
Chunk upload for iOS, Android, and web
Install
npm install capacitor-chunk-upload
npx cap sync
API
echo(...)
uploadFile(...)
addListener('uploadStarted', ...)
addListener('uploadProgressChanged', ...)
removeAllListeners()
- Interfaces
echo(...)
echo(options: { value: string; }) => Promise<{ value: string; }>
Param | Type |
---|---|
options | { value: string; } |
Returns: Promise<{ value: string; }>
uploadFile(...)
uploadFile(options: UploadOptions) => Promise<void>
Upload a file via chunk
Param | Type |
---|---|
options | UploadOptions |
addListener('uploadStarted', ...)
addListener(eventName: 'uploadStarted', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listens for event: upload started
Param | Type |
---|---|
eventName | 'uploadStarted' |
listenerFunc | () => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addListener('uploadProgressChanged', ...)
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()
removeAllListeners() => Promise<void>
Removes all listeners
Interfaces
UploadOptions
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 |
PluginListenerHandle
Prop | Type |
---|---|
remove | () => Promise<void> |
1.0.0
1 year ago