1.0.0 • Published 1 year ago

capacitor-chunk-upload v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

capacitor-chunk-upload

Chunk upload for iOS, Android, and web

Install

npm install capacitor-chunk-upload
npx cap sync

API

echo(...)

echo(options: { value: string; }) => Promise<{ value: string; }>
ParamType
options{ value: string; }

Returns: Promise<{ value: string; }>


uploadFile(...)

uploadFile(options: UploadOptions) => Promise<void>

Upload a file via chunk

ParamType
optionsUploadOptions

addListener('uploadStarted', ...)

addListener(eventName: 'uploadStarted', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Listens for event: upload started

ParamType
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

ParamType
eventName'uploadProgressChanged'
listenerFunc(progress: { percentage: number; }) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


removeAllListeners()

removeAllListeners() => Promise<void>

Removes all listeners


Interfaces

UploadOptions

Upload option

PropTypeDescription
urlstringThe URL to upload to
blobBlobThe file to upload. Only available on Web.
pathstringThe path of the file to upload. Only available on Android and iOS.
headers{ key: string: string; }Addition headers to send with the request

PluginListenerHandle

PropType
remove() => Promise<void>
1.0.0

1 year ago