Registry / security / wreq-js

wreq-js

JSON →
library2.3.1jsnpmunverified

wreq-js (v2.3.1) is a Node.js/TypeScript HTTP client that bypasses TLS fingerprinting checks (JA3/JA4) used by Cloudflare, DataDome, and other anti-bot services. It provides browser impersonation profiles for Chrome, Firefox, Safari, Edge, Opera, and OkHttp without running a full browser, using native Rust bindings from the wreq library for high throughput. Unlike alternatives like CycleTLS (Go subprocess) or got-scraping (JS customization), wreq-js offers a fetch-style API, built-in session and cookie management, proxy support, WebSocket helper, and TypeScript-first design with generated definitions. Prebuilt binaries are available for macOS, Linux, and Windows; installation may require a Rust toolchain if no matching prebuilt artifact is found. Development is active with community releases via npm.

npm install wreq-js
INSTALL
IMPORT
SIG · WREQ-JS
W
wreq-js
securityjavascriptv2.3.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

fetch
import { fetch } from 'wreq-js'
import fetch from 'wreq-js'
Named export, not default. ESM-only; no CJS support.
createSession
import { createSession } from 'wreq-js'
const createSession = require('wreq-js').createSession
ESM-only; require() will fail. Use import statement.
Session
import type { Session } from 'wreq-js'
Type import for session instance type. Not available as runtime value.
WebSocket
import { WebSocket } from 'wreq-js'
import ws from 'wreq-js'
Named export for WebSocket helper. Not default.
setGlobalProxy
import { setGlobalProxy } from 'wreq-js'
Function to set proxy globally. Only available in v2.x.

Demonstrates basic fetch with browser impersonation and a session-based flow with cookie persistence. Uses environment variable for auth.

import { fetch, createSession } from 'wreq-js'; // Ephemeral fetch with browser impersonation const res = await fetch('https://httpbin.org/ip', { browser: 'chrome_142', os: 'windows', }); console.log(await res.json()); // Session-based flow with cookie persistence const session = await createSession({ browser: 'chrome_142', os: 'macos', }); try { const loginRes = await session.fetch('https://example.com/login', { method: 'POST', body: JSON.stringify({ username: 'user', password: process.env.PASSWORD || 'pass' }), headers: { 'Content-Type': 'application/json' }, }); if (!loginRes.ok) { console.error('Login failed'); process.exit(1); } const profileRes = await session.fetch('https://example.com/profile'); console.log(await profileRes.json()); } finally { session.close(); }
Debug
Known issues
breakingAll module exports are ESM-only. CommonJS require() will fail.
fix
Use import statements or switch to dynamic import().
affects: >=2.0.0
deprecatedThe 'fetch' function without explicit 'browser' option defaults to a minimal TLS fingerprint that may be blocked.
fix
Always specify 'browser' and 'os' options when calling standalone fetch() or creating a session.
affects: >=2.0.0
gotchaInstallation may require a Rust toolchain if no prebuilt native binary matches your platform.
fix
Install Rust via rustup.rs or use a Docker image with Rust preinstalled.
affects: >=1.0.0
breakingSessions must be closed with session.close() to release native resources; failure to do so causes memory leaks.
fix
Wrap session usage in try/finally block and always call close().
affects: >=2.0.0
deprecatedProxy settings via environment variables (HTTP_PROXY, HTTPS_PROXY) may not be respected; use setGlobalProxy() or per-request options.
fix
Use explicit proxy configuration: import { setGlobalProxy } from 'wreq-js'; setGlobalProxy('http://proxy:8080');
affects: >=2.0.0 <2.3.0
gotchaThe browser profile names (e.g., 'chrome_142') may change with new releases; check compatibility matrix at https://wreq.sqdsh.win/concepts/compatibility-matrix.
fix
Pin version and review changelog when upgrading.
affects: >=2.0.0
gotchaSome anti-bot services may detect wreq-js as a bot based on non-TLS signals (e.g., HTTP headers, timing).
fix
Complement with header/behavior customization; consider using session's setHeaders() method.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'wreq-js'
Missing installation or incorrect import path.
fix
Run 'npm install wreq-js' and ensure your project uses ESM (type: 'module' in package.json or .mjs extension).
TypeError: wreq_js_1.fetch is not a function
Wrong import style: using default import instead of named import.
fix
Change 'import fetch from "wreq-js"' to 'import { fetch } from "wreq-js"'.
Error: Dynamic require of "wreq-js" is not supported
Using require() in an ESM context.
fix
Replace 'const wreq = require("wreq-js")' with 'import * as wreq from "wreq-js"' or use dynamic import().
Error: No prebuilt native binary found for current platform. Build from source requires Rust toolchain.
Your OS/architecture lacks a prebuilt artifact.
fix
Install Rust from https://rustup.rs and ensure cargo is in PATH, then npm install wreq-js again.
Error: The `session` object has been disposed. Cannot use after calling `close()` method.
Using a session after calling session.close().
fix
Ensure you do not reuse a closed session; create a new one if needed.
Upgrade
Version history
2.3.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
48 hits · last 30 days
node
38
OpenAI (training)
1
Resources