Impit JavaScript Bindings (Linux x64 Musl)

0.13.0 · active · verified Sun Apr 19

Impit provides high-performance HTTP client bindings with advanced fingerprinting capabilities, primarily targeting web scraping and automation scenarios. This specific package, `impit-linux-x64-musl`, delivers the compiled x86_64 Linux Musl libc binary for the Node.js implementation. It is typically consumed as a platform-specific dependency by the main `impit-node` package, which exposes a Fetch API-compatible interface to JavaScript developers. The project is under active development, with frequent releases across its JavaScript and Python clients. Key features in recent versions (currently `impit-node@0.13.0`) include emulation profiles for OkHTTP and custom HTTP/2 SETTINGS, enhanced error reporting for Node.js bindings, and improved stability through JavaScript-layer handling of redirects and cookies. Its core differentiation lies in its ability to mimic various browser and client fingerprints to evade sophisticated bot detection systems.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to initialize an `ImpitClient` with global options and perform requests, along with using the standalone `fetch` function for per-request configuration, including fingerprinting, custom headers, and timeout options.

import { ImpitClient, fetch, RequestInit } from 'impit-node';

async function runImpitExample() {
  const impitClient = new ImpitClient({
    // Emulate a specific browser fingerprint for advanced anti-bot detection
    fingerprint: 'chrome-100',
    // Global timeout for all requests made with this client
    timeout: 30000, // 30 seconds
    // Whether to follow redirects globally
    followRedirects: true,
  });

  try {
    console.log('--- Using ImpitClient instance ---');
    const clientResponse = await impitClient.fetch('https://httpbin.org/get', {
      headers: {
        'X-Client-Header': 'ImpitClient',
      },
      // Per-request redirect override (new in 0.12.0)
      redirect: 'manual'
    } as RequestInit);

    if (clientResponse.ok) {
      const data = await clientResponse.json();
      console.log('Client response status:', clientResponse.status);
      console.log('Client response headers (content-type):', clientResponse.headers.get('Content-Type'));
      console.log('Client response data (origin):', data.origin);
    } else {
      console.error('Client request failed:', clientResponse.status, await clientResponse.text());
    }

    console.log('\n--- Using direct fetch function ---');
    const directResponse = await fetch('https://httpbin.org/anything', {
      fingerprint: 'firefox-99', // Can specify fingerprint per-request
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-Direct-Fetch-Header': 'ImpitGlobalFetch',
      },
      body: JSON.stringify({ message: 'Hello from Impit direct fetch!' }),
      // Disable timeout for this specific request (check impit-node changelog for exact version)
      timeout: null
    } as RequestInit);

    if (directResponse.ok) {
      const data = await directResponse.json();
      console.log('Direct fetch response status:', directResponse.status);
      console.log('Direct fetch data (method):', data.method);
      console.log('Direct fetch data (json):', data.json);
    } else {
      console.error('Direct fetch failed:', directResponse.status, await directResponse.text());
    }
  } catch (error) {
    console.error('An error occurred:', error);
  }
}

runImpitExample();

view raw JSON →