Skip to main content

Exports

wreq-js exports the following functions and classes:
import {
  // Core functions
  fetch,
  createSession,
  withSession,
  websocket,
  
  // Utilities
  getProfiles,
  getOperatingSystems,
  
  // Classes
  Headers,
  Request,
  Response,
} from 'wreq-js';

Quick reference

FunctionDescription
fetch()Make HTTP requests with browser fingerprinting
createSession()Create a persistent session with cookie storage
withSession()Auto-disposing session helper
websocket()Connect to WebSocket servers
getProfiles()List available browser profiles
getOperatingSystems()List available operating systems

TypeScript support

wreq-js includes full TypeScript definitions. All types are exported:
import type {
  BrowserProfile,
  EmulationOS,
  RequestInit,
  CreateSessionOptions,
  Session,
} from 'wreq-js';

Fetch API compatibility

wreq-js aims to be compatible with the standard Fetch API while adding browser impersonation features:
Standard Fetchwreq-js
fetch(url, init)✅ Supported
Request class✅ Supported
Response class✅ Supported
Headers class✅ Supported
AbortController✅ Supported
ReadableStream body✅ Supported
Service Workers❌ Not applicable
Cache API❌ Not applicable

wreq-js extensions

Additional options beyond the standard Fetch API:
interface RequestInit {
  // Standard options
  method?: string;
  headers?: HeadersInit;
  body?: BodyInit | null;
  signal?: AbortSignal | null;
  redirect?: 'follow';
  
  // wreq-js extensions
  browser?: BrowserProfile;      // Browser fingerprint profile
  os?: EmulationOS;              // Operating system emulation
  proxy?: string;                // Proxy URL
  timeout?: number;              // Request timeout in ms
  disableDefaultHeaders?: boolean; // Disable auto-added headers
  insecure?: boolean;            // Accept invalid certificates
}