capacitor-chunk-upload
v1.1.0
Published
Chunk upload for iOS, Android, and web
Readme
capacitor-chunk-upload
Chunk upload for iOS, Android, and web
Install
npm install capacitor-chunk-upload
npx cap syncAPI
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>Listens for event: upload started
| Param | Type |
| ------------------ | ---------------------------- |
| eventName | 'uploadStarted' |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
addListener('uploadProgressChanged', ...)
addListener(eventName: 'uploadProgressChanged', listenerFunc: (progress: { percentage: number; }) => void) => Promise<PluginListenerHandle>Listens for event: upload progress changed
| Param | Type |
| ------------------ | ----------------------------------------------------------- |
| eventName | 'uploadProgressChanged' |
| listenerFunc | (progress: { percentage: number; }) => void |
Returns: Promise<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> |
