npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

capacitor-cors-bypass-enhanced

v1.2.2

Published

Enhanced Capacitor plugin for CORS bypass with HTTP/2, HTTP/3, gRPC, GraphQL, file operations, and advanced networking features. Modular TypeScript definitions for better maintainability.

Downloads

2,479

Readme

Capacitor CORS Bypass Enhanced

🚀 The ultimate Capacitor plugin for advanced networking and CORS bypass

A comprehensive Capacitor plugin that provides powerful networking capabilities including CORS bypass, modern protocol support (HTTP/2, HTTP/3, gRPC, GraphQL), file operations, and advanced network management features.

✨ Features

🌐 Core Networking

  • CORS Bypass - Complete bypass of browser CORS restrictions
  • Network Proxy ✅ NEW - HTTP, HTTPS, SOCKS4, SOCKS5 proxy support with authentication
  • HTTP/2 Support ✅ - Multiplexing, server push, stream prioritization (Android & iOS)
  • HTTP/3 (QUIC) ⏭️ - Planned (requires OkHttp 5.0 stable or Cronet integration)
  • Protocol Auto-Detection ✅ - Automatic protocol negotiation and fallback
  • Performance Monitoring ✅ - DNS, TCP, TLS, TTFB metrics tracking
  • Server-Sent Events (SSE) - Real-time event streaming
  • WebSocket Enhanced - Auto-reconnect, heartbeat, connection pooling

🔧 Advanced Protocols

  • gRPC - High-performance RPC with streaming support
  • GraphQL - Queries, mutations, subscriptions with caching
  • MCP (Model Context Protocol) - AI model communication with StreamableHTTP support ✨NEW
    • StreamableHTTP Transport ✅ - Single-endpoint, bidirectional communication
    • Session Resumability ✅ - Reconnect and resume message streams
    • Backward Compatible ✅ - Legacy SSE transport still supported

📁 File Operations

  • File Download - Progress tracking, resume, speed control
  • File Upload - Multi-part uploads with progress
  • Batch Operations - Concurrent file processing

🚀 Performance Features

  • Connection Pooling - Efficient connection reuse
  • Batch Requests - Parallel request processing with retry logic
  • Smart Caching - Compressed storage with TTL
  • Network Monitoring - Real-time performance metrics

🛠 Data Processing

  • Multi-format Parsing - JSON, XML, CSV, YAML, HTML, Markdown, Base64
  • Data Transformation - Format conversion and extraction
  • Compression - Built-in gzip/deflate support

📦 Installation

npm install capacitor-cors-bypass-enhanced
npx cap sync

🚀 Quick Start

Basic HTTP Request with CORS Bypass

import { CorsBypass } from 'capacitor-cors-bypass-enhanced';

// Simple request
const response = await CorsBypass.makeRequest({
  url: 'https://api.example.com/data',
  method: 'GET',
  headers: { 'Authorization': 'Bearer token' }
});

console.log('Success:', response.success);
console.log('Data:', response.data);
console.log('Duration:', response.duration + 'ms');

HTTP/2 and HTTP/3 Support

// Automatic protocol selection (HTTP/3 -> HTTP/2 -> HTTP/1.1)
const response = await CorsBypass.get({
  url: 'https://api.example.com/data'
});

console.log('Protocol:', response.protocolVersion); // 'h2' or 'h3'
console.log('Performance:', response.metrics);

// Configure protocol options
const response = await CorsBypass.get({
  url: 'https://api.example.com/data',
  protocolConfig: {
    http2: {
      enabled: true,
      pushEnabled: true,
      pingInterval: 10000
    },
    http3: {
      enabled: true,  // Android only
      zeroRtt: true
    },
    fallback: {
      enabled: true,
      retryCount: 2,
      preferredProtocols: ['h3', 'h2', 'http/1.1']
    }
  }
});

// Performance metrics
if (response.metrics) {
  console.log('DNS Time:', response.metrics.dnsTime, 'ms');
  console.log('TCP Time:', response.metrics.tcpTime, 'ms');
  console.log('TLS Time:', response.metrics.tlsTime, 'ms');
  console.log('TTFB:', response.metrics.ttfb, 'ms');
  console.log('Download Speed:', response.metrics.downloadSpeed, 'bytes/sec');
}

Network Proxy Support ✨NEW

import { CorsBypass } from 'capacitor-cors-bypass-enhanced';

// Set global proxy (applies to all requests)
await CorsBypass.setGlobalProxy({
  enabled: true,
  type: 'http',  // 'http' | 'https' | 'socks4' | 'socks5'
  host: '127.0.0.1',
  port: 8080,
  username: 'user',      // Optional
  password: 'pass',      // Optional
  bypass: ['localhost', '*.local'],  // Optional bypass list
  applyToAll: true
});

// Test proxy connection
const testResult = await CorsBypass.testProxy({
  enabled: true,
  type: 'socks5',
  host: '127.0.0.1',
  port: 1080
}, 'https://www.google.com');

console.log('Proxy test:', testResult.success ? 'OK' : testResult.error);
console.log('Response time:', testResult.responseTime, 'ms');

// Per-request proxy (overrides global proxy)
const response = await CorsBypass.get({
  url: 'https://api.example.com/data',
  proxy: {
    enabled: true,
    type: 'http',
    host: 'proxy.company.com',
    port: 3128
  }
});

// Get proxy status
const status = await CorsBypass.getProxyStatus();
console.log('Active:', status.active);
console.log('Request count:', status.requestCount);

// Clear global proxy
await CorsBypass.clearGlobalProxy();

gRPC Service Calls

const grpcResponse = await CorsBypass.callGRPC({
  url: 'https://grpc.api.example.com',
  service: 'UserService',
  method: 'GetUser',
  data: { userId: 123 },
  metadata: { 'authorization': 'Bearer token' },
  compression: 'gzip'
});

console.log('gRPC Status:', grpcResponse.status);
console.log('Response:', grpcResponse.data);

GraphQL with Caching

const graphqlResponse = await CorsBypass.queryGraphQL({
  url: 'https://api.example.com/graphql',
  query: `
    query GetUser($id: ID!) {
      user(id: $id) {
        name
        email
        posts { title }
      }
    }
  `,
  variables: { id: '123' },
  cache: { enabled: true, ttl: 300000 } // 5 min cache
});

console.log('Data:', graphqlResponse.data);
console.log('Cache hit:', graphqlResponse.cache?.hit);

Batch Requests with Retry

const results = await CorsBypass.batchRequests([
  {
    url: 'https://api1.example.com/data',
    id: 'req1',
    priority: 1,
    retry: { maxAttempts: 3, delay: 1000 }
  },
  {
    url: 'https://api2.example.com/data',
    id: 'req2',
    priority: 2
  }
]);

results.forEach(result => {
  console.log(`${result.id}: ${result.success ? 'Success' : 'Failed'}`);
  console.log(`Duration: ${result.duration}ms, Attempts: ${result.attempts}`);
});

File Download with Progress

const download = await CorsBypass.downloadFile({
  url: 'https://example.com/large-file.zip',
  filePath: '/storage/downloads/file.zip',
  resume: true,
  maxSpeed: 1024 * 1024 // 1MB/s
});

// Listen for progress
CorsBypass.addListener('downloadProgress', (progress) => {
  const percent = (progress.bytesDownloaded / progress.totalSize) * 100;
  console.log(`Download: ${percent.toFixed(2)}%`);
});

Smart Caching

// Set cache with compression
await CorsBypass.manageCache({
  operation: 'set',
  key: 'user_data',
  value: userData,
  expiration: 3600000, // 1 hour
  compression: { enabled: true, algorithm: 'gzip' }
});

// Get cached data
const cached = await CorsBypass.manageCache({
  operation: 'get',
  key: 'user_data'
});

if (cached.hit) {
  console.log('Cache hit:', cached.value);
}

Data Parsing

// Parse CSV data
const csvResult = await CorsBypass.parseData({
  data: 'name,age\nJohn,25\nJane,30',
  format: 'csv',
  options: { delimiter: ',' }
});

// Parse JSON with JSONPath
const jsonResult = await CorsBypass.parseData({
  data: '{"users": [{"name": "John"}, {"name": "Jane"}]}',
  format: 'json',
  options: { jsonPath: '$.users[*].name' }
});

🔧 Configuration

Android Setup

Add to your MainActivity.java:

import com.capacitor.cors.CorsBypassPlugin;

public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
      add(CorsBypassPlugin.class);
    }});
  }
}

iOS Setup

The plugin will be automatically registered on iOS.

📚 API Documentation

For complete API documentation with all interfaces and options, see:

🎯 Use Cases

  • Enterprise API Integration - Connect to internal APIs without CORS issues
  • AI/LLM Integration - Connect to MCP servers using StreamableHTTP ✨NEW
  • Real-time Applications - SSE, WebSocket, GraphQL subscriptions
  • File Management - Upload/download with progress tracking
  • Performance Optimization - HTTP/2, connection pooling, caching
  • Microservices - gRPC communication between services
  • Data Processing - Parse and transform various data formats
  • Network Monitoring - Track performance and debug issues

🤝 Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests.

📄 License

MIT License - see LICENSE file for details.

🔗 Links

🏷️ Version History

  • 1.0.0 - Initial release with full feature set
    • CORS bypass for all HTTP methods
    • HTTP/2 and HTTP/3 support
    • gRPC and GraphQL protocols
    • File operations with progress tracking
    • Advanced caching and data parsing
    • Network monitoring and connection pooling

Made with ❤️ by the AetherLink Team