A capacitor plugin provides `fetch` with stream support
npm install capacitor-stream-fetchbash
npm install capacitor-stream-fetch
npx cap sync
`
Usage
`typescript
import { fetch } from 'capacitor-stream-fetch'
// Use it like native fetch
`
API
streamFetch(...)
* addListener(string, ...)
* removeAllListeners()
* Interfaces
$3
`typescript
streamFetch(options: { url: string; method: string; headers: Record; body?: string; }) => any
`Execute a HTTP request with streaming response
| Param | Type | Description |
| ------------- | -------------------------------------------------------------------------- | ------------------- |
|
options | { url: string; method: string; headers: any; body?: string; } | The request options |Returns: any
--------------------
$3
`typescript
addListener(eventName: string, listenerFunc: (event: any) => void) => any
`Add a listener for a specific event
| Param | Type | Description |
| ------------------ | ------------------------------------ | --------------------------------------------------- |
|
eventName | string | Name of the event to listen for |
| listenerFunc | (event: any) => void | Callback function to be called when the event fires |Returns: any
--------------------
$3
`typescript
removeAllListeners() => any
`Remove all listeners for this plugin
Returns: any
--------------------
$3
#### StreamResponse
| Prop | Type |
| ---------------- | ----------------------------------------- |
|
requestId | number |
| status | number |
| statusText | string |
| headers | Record<string, string> |
#### PluginListenerHandle
| Prop | Type |
| ------------ | ------------------------- |
|
remove` | () => any |