Registry / http-networking / capacitor-stream-http

capacitor-stream-http

JSON →
library0.1.0jsnpmunverified

Capacitor plugin for native HTTP streaming on iOS and Android, version 0.1.0. Enables true chunk-by-chunk streaming for Server-Sent Events (SSE) and other streaming APIs, with support for custom headers, request body, and cancellation. Differentiates from standard fetch by leveraging native URLSession (iOS) and HttpURLConnection (Android) for efficient streaming that works behind proxy configurations on mobile devices. Does not support web platform; falls back to fetch API. Maintained by chatbox, licensed MIT.

npm install capacitor-stream-http
INSTALL
IMPORT
SIG · CAPACITOR-STREAM-H
C
capacitor-stream-http
http-networkingjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

StreamHttp
import { StreamHttp } from 'capacitor-stream-http'
import StreamHttp from 'capacitor-stream-http'
Default export is not provided; use named import for the plugin object.
createNativeReadableStream
import { createNativeReadableStream } from 'capacitor-stream-http'
import { createNativeReadableStream } from 'capacitor-stream-http/src/index'
Do not reference internal paths; use the package top-level export.
StreamHttpPlugin
import type { StreamHttpPlugin } from 'capacitor-stream-http'
Type import for Capacitor plugin type declarations; available since v0.1.0.

Demonstrates how to listen for chunk events, start a GET stream, and cancel it after 5 seconds.

import { StreamHttp } from 'capacitor-stream-http'; // Listen for chunks await StreamHttp.addListener('chunk', (data) => { console.log('Received chunk:', data.chunk); }); // Start streaming const { id } = await StreamHttp.startStream({ url: 'https://api.example.com/stream', method: 'GET', }); // After some time, cancel the stream setTimeout(async () => { await StreamHttp.cancelStream({ id }); }, 5000);
Debug
Known issues
breakingNot supported on web platform; web builds will throw an error or silently fail.
fix
Check if running on native platform before using this plugin, or fall back to fetch/ReadableStream for web.
affects: >=0.1.0
deprecatedNo deprecations yet.
fix
N/A
affects: >=0.0.0
gotchaThe startStream method returns an object with an 'id' property; you must store this ID to cancel the stream later.
fix
Always destructure { id } from the result.
affects: >=0.1.0
gotchaEvent listeners (addListener) must be removed to prevent memory leaks; the plugin does not auto-remove them.
fix
Store listener references and call removeAllListeners or removeListener when done.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Unsupported platform web
Using the plugin in a web (browser) environment where native APIs are not available.
fix
Use feature detection: if (Capacitor.getPlatform() !== 'web') { /* use plugin */ } else { /* fallback to fetch */ }
TypeError: StreamHttp.startStream is not a function
Incorrect import: using default import instead of named import.
fix
Change to: import { StreamHttp } from 'capacitor-stream-http'
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
@capacitor/corerequiredDepends on Capacitor runtime for plugin lifecycle and native bridge communication
Agent activity
18 hits · last 30 days
node
14
OpenAI (training)
1
Resources
capacitor-stream-http — npm install capacitor-stream-http · libregistry