### Install Dependencies and Run Mock Server Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/examples/19-binary-data-protobuf/README.md Installs project dependencies using yarn and starts the mock server by running the 'server.js' script. This server is intended to facilitate the Protobuf binary data example. ```bash yarn node server.js ``` -------------------------------- ### Run Example Script Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/examples/README.md Execute a specific example script using Node.js. ```bash node 17-ssh.js ``` -------------------------------- ### Complete API Client Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curly.md Demonstrates how to build a complete API client using the impersonate function for browser emulation and custom default options. This client supports GET, POST, PUT, and DELETE requests. ```typescript const { impersonate, Browser } = require('node-libcurl-ja3') class APIClient { constructor(baseUrl, token) { this.client = impersonate(Browser.Chrome, { curlyBaseUrl: baseUrl, httpHeader: [ `Authorization: Bearer ${token}`, 'Content-Type: application/json', 'Accept: application/json' ], curlyGetInfo: false, sslVerifypeer: false }) } async get(path) { const response = await this.client.get(path) return response.data } async post(path, body) { const response = await this.client.post(path, { postFields: JSON.stringify(body) }) return response.data } async put(path, body) { const response = await this.client.put(path, { postFields: JSON.stringify(body) }) return response.data } async delete(path) { const response = await this.client.delete(path) return response.data } } // Usage const api = new APIClient('https://api.example.com', 'token123') const users = await api.get('/users') const newUser = await api.post('/users', { name: 'John' }) const updated = await api.put('/users/1', { name: 'Jane' }) await api.delete('/users/1') ``` -------------------------------- ### Install with npm (Build from Source) Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/README.md Use this command to install the package and force compilation from source, bypassing prebuilt binaries. ```sh npm install node-libcurl-ja3 --build-from-source ``` -------------------------------- ### Install node-libcurl-ja3 with npm Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/README.md Use this command to install the library using npm. ```shell npm i node-libcurl-ja3 --save ``` -------------------------------- ### Install with yarn (Build from Source) Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/README.md Use this command with yarn to install the package and force compilation from source, bypassing prebuilt binaries. ```sh npm_config_build_from_source=true yarn add node-libcurl-ja3 ``` -------------------------------- ### Install Dependencies Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/examples/README.md Install project dependencies using Yarn. ```bash yarn ``` -------------------------------- ### Install node-libcurl-ja3 with yarn Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/README.md Use this command to install the library using yarn. ```shell yarn add node-libcurl-ja3 ``` -------------------------------- ### Browser Impersonation Setup (Conceptual) Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curl-class.md Demonstrates the initial setup for browser impersonation using node-libcurl-ja3. Further configuration can be done manually or by using the higher-level 'curly' API. ```typescript const { Curl, Browser } = require('node-libcurl-ja3') const curl = new Curl() // Get Chrome impersonation options const chromeOptions = Curl.option // Built-in options // Then manually set them, or use the curly API: ``` -------------------------------- ### Accessing Browser Configuration Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/impersonate.md Shows how to retrieve and inspect the configuration for a specific browser from BROWSER_CONFIGS. ```typescript const { BROWSER_CONFIGS } = require('node-libcurl-ja3') const chromeConfig = BROWSER_CONFIGS['Chrome'] console.log(chromeConfig.headers) console.log(chromeConfig.tlsVersion) ``` -------------------------------- ### High-Level API Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/README.md Demonstrates a simple GET request using the high-level 'curly' API, suitable for most users. This pattern is non-blocking. ```javascript const { curly } = require('node-libcurl'); async function example() { const { data } = await curly.get('https://example.com'); console.log(data); } ``` -------------------------------- ### Install Dependencies and Build Addon Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/CONTRIBUTING.md Install project dependencies using yarn, which also builds the addon. This is a standard step after cloning the repository or updating dependencies. ```sh $ yarn install ``` -------------------------------- ### Install lldb on Debian Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/CONTRIBUTING.md Install the LLDB debugger on Debian-based Linux systems using apt-get. ```sh sudo apt-get install lldb ``` -------------------------------- ### getCurlOptionsFromBrowser Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/impersonate.md Example of retrieving libcurl options for a browser and how to apply them using Curl.setOpt(). ```typescript const { getCurlOptionsFromBrowser, Browser } = require('node-libcurl-ja3') const chromeOptions = getCurlOptionsFromBrowser(Browser.Chrome) // Use with Curl.setOpt() ``` -------------------------------- ### Example Usage of Share Class Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/easy-multi-share.md Demonstrates how to create a Share handle, configure it to share cookies and DNS, and assign it to multiple Curl instances. ```javascript const { Curl, Share, CurlShareLock } = require('node-libcurl-ja3') // Create a share handle const share = new Share() // Share cookies and DNS cache share.setOpt('SHARE', CurlShareLock.Cookie) share.setOpt('SHARE', CurlShareLock.DNS) // Create Curl instances that share data const curl1 = new Curl() const curl2 = new Curl() curl1.setOpt('SHARE', share) curl2.setOpt('SHARE', share) // Both instances now share cookies and DNS cache curl1.setOpt('URL', 'https://example.com/login') curl1.on('end', () => { console.log('Login complete, cookies shared with curl2') curl1.close() // curl2 will have the login cookies curl2.setOpt('URL', 'https://example.com/api') curl2.perform() }) curl1.perform() curl2.on('end', () => { console.log('API request made with shared cookies') curl2.close() share.close() }) ``` -------------------------------- ### getCurlOptionsFromBrowserConfig Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/impersonate.md Demonstrates creating a custom configuration object and converting it into libcurl options for use with curl.setOpt(). ```typescript const { getCurlOptionsFromBrowserConfig } = require('node-libcurl-ja3') const customConfig = { headers: { 'User-Agent': 'Custom Chrome', 'Accept': 'text/html' }, tlsVersion: CurlSslVersion.TlsV1_3, ciphers: 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384' } const options = getCurlOptionsFromBrowserConfig(customConfig) curl.setOpt(options) ``` -------------------------------- ### Install Node.js lldb Plugin Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/CONTRIBUTING.md Install the llnode plugin globally to enable debugging Node.js applications with LLDB. ```sh npm i -g llnode ``` -------------------------------- ### Get libcurl version string Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curl-class.md Retrieves the libcurl version string, including library information. Example output: `libcurl/8.15.0-IMPERSONATE BoringSSL zlib/1.3.1`. ```typescript static getVersion(): string ``` -------------------------------- ### Setting HTTPPOST Option Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/types.md Shows how to use the `setOpt` method with the `HTTPPOST` option to configure multipart/form-data uploads. Requires importing the `Curl` class. ```typescript const { Curl } = require('node-libcurl-ja3') const curl = new Curl() curl.setOpt('HTTPPOST', [ { name: 'field', contents: 'value' }, { name: 'file', file: '/path/to/file.txt' }, { name: 'data', fileContent: Buffer.from('binary'), type: 'application/octet-stream' } ]) ``` -------------------------------- ### Impersonate Browser Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/impersonate.md Demonstrates how to use the impersonate function with browser constants to set up client impersonation. ```typescript const { Browser, impersonate } = require('node-libcurl-ja3') const chrome = impersonate(Browser.Chrome) const firefox = impersonate(Browser.Firefox) ``` -------------------------------- ### Install Additional Packages on macOS using Homebrew Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/README.md Installs essential build tools and libraries on macOS using Homebrew. ```sh brew install automake bash cmake libtool make meson ninja ``` -------------------------------- ### Get HTTP Headers Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/types.md Demonstrates how to retrieve and access specific headers from an HTTP response using the node-libcurl-ja3 library. Requires the 'curly' export. ```typescript const { curly } = require('node-libcurl-ja3') const { headers } = await curly.get('https://example.com') console.log(headers[0]['content-type']) console.log(headers[0]['server']) ``` -------------------------------- ### parseFingerprint Examples Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/impersonate.md Provides examples for parsing JA3, JA4, and Akamai fingerprint strings into ImpersonateConfig objects. ```typescript const { parseFingerprint } = require('node-libcurl-ja3') // Parse JA3 fingerprint const ja3Config = parseFingerprint({ ja3: '771,4865-4866-4867-49195-49199-52393-52392-49196-49200-49327-49325-49324-49323,0-23-65281-10-11-35-16-5-13-51-45-43-21,23-24-25-28-29-30-256-257-258-259-260' }) // Parse JA4 fingerprint const ja4Config = parseFingerprint({ ja4: 't13d1514h1_8414caf546b5_1f476e52bc4a' }) // Parse Akamai fingerprint const akamiConfig = parseFingerprint({ akami: '1:65280,3:0|1:1,2,3,4,5,6|h2=1,h2c=1' }) ``` -------------------------------- ### Example Usage of Multi Class Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/easy-multi-share.md Demonstrates creating multiple Easy handles, adding them to a Multi instance, setting URLs, and handling completion callbacks for asynchronous requests. ```javascript const { Multi, Easy, CurlCode } = require('node-libcurl-ja3') const multi = new Multi() // Create multiple Easy handles const easy1 = new Easy() const easy2 = new Easy() easy1.setOpt('URL', 'https://example.com/1') easy2.setOpt('URL', 'https://example.com/2') // Add to multi queue multi.addHandle(easy1) multi.addHandle(easy2) // Callback when requests complete multi.onMessage((error, handle, errorCode) => { if (error) { console.error('Error:', error, errorCode) } else { console.log('Request completed') } multi.removeHandle(handle) handle.close() }) // Start transfers (non-blocking) multi.perform() ``` -------------------------------- ### Start Static Folder Server Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/tools/brute-force-server-static-folder/README.md Use http-server to serve a static folder for testing purposes. This is useful for simulating a target server during brute-force tests. ```bash http-server ./tools/brute-force-server-static-folder -p 8080 ``` -------------------------------- ### Install Xcode Command Line Tools on macOS Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/README.md Installs Xcode Command Line Tools if they are not already present. ```sh xcode-select --install ``` -------------------------------- ### Instance Methods Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/parseheaders.md Common instance methods for managing a libcurl handle, including setting options, getting information, and cleanup. ```APIDOC ## Instance Methods ### Set Option Sets an option for the libcurl handle. ```typescript handle.setOpt(optionName: string | number, optionValue: any) ``` ### Get Info Retrieves information about the libcurl handle. ```typescript const result: any = handle.getInfo(infoName: string | number) ``` ### Close Handle Closes and cleans up the libcurl handle. ```typescript handle.close() ``` ### Reset Handle Resets the libcurl handle to its default state. ```typescript handle.reset() ``` ### Duplicate Handle Creates a duplicate of the current libcurl handle. ```typescript const clone: CurlHandle = handle.dupHandle() ``` ``` -------------------------------- ### JavaScript Import Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/README.md Demonstrates how to import the Curl class in a JavaScript environment using require(). ```javascript const { Curl } = require('node-libcurl-ja3') ``` -------------------------------- ### TypeScript Import Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/README.md Shows how to import the Curl and CurlCode classes in a TypeScript environment using import. ```typescript import { Curl, CurlCode } from 'node-libcurl-ja3' ``` -------------------------------- ### Install Required Dependencies on Debian-based Linux Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/README.md Installs necessary build tools and libraries for compiling node-libcurl-ja3 on Debian-based systems. ```sh sudo apt install -qqy autoconf automake build-essential cmake curl libtool ninja-build pkg-config ``` -------------------------------- ### Usage of ProgressCallback Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/types.md Example demonstrating how to set and use a progress callback function. It logs download and upload progress and shows how to return 0 to continue or a non-zero value to abort. ```typescript const { Curl } = require('node-libcurl-ja3') curl.setProgressCallback((dltotal, dlnow, ultotal, ulnow) => { console.log(`Download: ${dlnow}/${dltotal}`) console.log(`Upload: ${ulnow}/${ultotal}`) // Return 0 to continue return 0 // Return non-zero to abort (e.g., if file too large) // if (dltotal > 100 * 1024 * 1024) return 1 // Abort if > 100MB }) ``` -------------------------------- ### Basic GET Request Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curly.md Demonstrates how to perform a basic HTTP GET request using the default `curly` instance and retrieve the response data, status code, and headers. ```APIDOC ## Basic GET Request Performs a basic HTTP GET request and retrieves response details. ### Method `GET` ### Endpoint `https://api.example.com/users` ### Parameters - **url** (string) - Required - The URL to fetch. - **options** (CurlyOptions) - Optional - Configuration for the request. ### Response - **data** (any) - The response body, typically parsed JSON. - **statusCode** (number) - The HTTP status code of the response. - **headers** (object) - An object containing the response headers. ### Example ```typescript const { curly } = require('node-libcurl-ja3') const { data, statusCode, headers } = await curly.get('https://api.example.com/users') console.log(statusCode) // 200 console.log(data) // Parsed JSON ``` ``` -------------------------------- ### Easy Class Example Usage Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/easy-multi-share.md Demonstrates how to instantiate and use the Easy class for a synchronous HTTP request. Note that easy.perform() is blocking and not recommended for asynchronous operations. ```javascript const { Easy } = require('node-libcurl-ja3') const easy = new Easy() // This is BLOCKING - not recommended for async code easy.setOpt('URL', 'https://example.com') easy.setOpt('FOLLOWLOCATION', true) const code = easy.perform() if (code === 0) { const { code, data } = easy.getInfo('RESPONSE_CODE') console.log('Status:', data) } easy.close() ``` -------------------------------- ### Multi-Browser Setup and Testing Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/impersonate.md This snippet shows how to create impersonation clients for multiple browsers simultaneously and test them against a given URL. It collects status codes and data lengths for comparison. ```typescript const { impersonate, Browser } = require('node-libcurl-ja3') // Create clients for different browsers const browsers = { chrome: impersonate(Browser.Chrome), firefox: impersonate(Browser.Firefox), safari: impersonate(Browser.Safari), edge: impersonate(Browser.Edge) } async function testMultipleBrowsers(url) { const results = {} for (const [name, client] of Object.entries(browsers)) { const response = await client.get(url) results[name] = { statusCode: response.statusCode, dataLength: response.data.toString().length } } return results } ``` -------------------------------- ### Basic GET Request with Response Details Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curly.md Execute a basic GET request and capture the response data, HTTP status code, and headers. The data is typically parsed JSON. ```typescript const { curly } = require('node-libcurl-ja3') const { data, statusCode, headers } = await curly.get('https://api.example.com/users') console.log(statusCode) // 200 console.log(data) // Parsed JSON ``` -------------------------------- ### Request with Query Parameters Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curly.md Demonstrates how to append query parameters to a URL for GET requests and enable following redirects. ```APIDOC ## Request with Query Parameters Appends query parameters to a URL and enables following redirects. ### Method `GET` ### Endpoint `https://api.example.com/search?q=test&limit=10` ### Parameters - **url** (string) - Required - The URL with query parameters. - **options** (CurlyOptions) - Optional - Configuration for the request. - **followLocation** (boolean) - Optional - If true, the request will follow HTTP redirects. ### Response - **data** (any) - The response body. ### Example ```typescript const { curly } = require('node-libcurl-ja3') const { data } = await curly.get('https://api.example.com/search?q=test&limit=10', { followLocation: true }) ``` ``` -------------------------------- ### Complete Node-libcurl-ja3 Option Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/configuration.md This snippet shows how to configure a wide range of options for making a request with node-libcurl-ja3. It includes settings for URL, redirects, HTTP version, headers, SSL/TLS, timeouts, authentication, performance, and progress callbacks. ```typescript const { Curl, CurlAuth, CurlHttpVersion, CurlSslVersion } = require('node-libcurl-ja3') const curl = new Curl() curl.setOpt('URL', 'https://api.example.com/data') .setOpt('FOLLOWLOCATION', true) .setOpt('MAXREDIRS', 5) // HTTP .setOpt('HTTP_VERSION', CurlHttpVersion.Http2_0) .setOpt('HTTPHEADER', [ 'Accept: application/json', 'X-API-Key: secret123' ]) // SSL/TLS .setOpt('SSLVERSION', CurlSslVersion.TlsV1_3) .setOpt('SSL_VERIFYPEER', true) .setOpt('SSL_CIPHER_LIST', 'TLS_AES_128_GCM_SHA256') // Timeouts .setOpt('TIMEOUT', 30) .setOpt('CONNECTTIMEOUT', 10) // Auth .setOpt('HTTPAUTH', CurlAuth.Bearer) // Performance .setOpt('PIPEWAIT', true) // Callbacks .setProgressCallback((dltotal, dlnow, ultotal, ulnow) => { console.log(`Progress: ${dlnow}/${dltotal}`) return 0 }) curl.on('end', (statusCode, data, headers) => { console.log('Success:', statusCode) curl.close() }) curl.on('error', (error, errorCode) => { console.error('Error:', error, errorCode) curl.close() }) curl.perform() ``` -------------------------------- ### Easy Class Methods Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/easy-multi-share.md Lists common methods available on the Easy class for interacting with libcurl, such as setting options, getting information, and performing requests. ```typescript // Set options setOpt(option: number | string, value: any): CurlCode // Get info getInfo(info: number | string): { code: CurlCode; data: any } // Perform request (blocking) perform(): CurlCode // Reset handle reset(): void // Duplicate handle dupHandle(): EasyNativeBinding // Control transfer pause(bitmask: CurlPause): CurlCode // Connection upkeep upkeep(): CurlCode // Close handle close(): void ``` -------------------------------- ### Configure Operation and Connection Timeouts Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/errors.md This example configures both the overall operation timeout and the initial connection timeout for libcurl requests. It's useful for preventing 'Operation Timeout' errors (code 28) and connection issues (code 7). ```typescript curl.setOpt('TIMEOUT', 60) // 60 seconds curl.setOpt('TIMEOUT_MS', 60000) // 60000 milliseconds curl.setOpt('CONNECTTIMEOUT', 30) ``` -------------------------------- ### Simple Request - Using Curl class Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/README.md Perform a simple GET request using the 'Curl' class. Requires importing Curl. ```javascript const { Curl } = require('node-libcurl-ja3'); const curl = new Curl(); curl.setOpt('URL', 'www.google.com'); curl.setOpt('FOLLOWLOCATION', true); curl.on('end', function (statusCode, data, headers) { console.info(statusCode); console.info('---'); console.info(data.length); console.info('---'); console.info(this.getInfo( 'TOTAL_TIME')); this.close(); }); curl.on('error', curl.close.bind(curl)); curl.perform(); ``` -------------------------------- ### Get Node.js Environment Information Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/parseheaders.md Accesses package version and runtime environment details like Node.js version, platform, and architecture. ```typescript const pkg = require('./package.json') console.log(pkg.version) // '5.2.2' console.log(process.version) // Node.js version console.log(process.platform) // 'linux', 'darwin' console.log(process.arch) // 'x64', 'arm64' ``` -------------------------------- ### Promise-Based Async Pattern Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/README.md Shows the promise-based asynchronous pattern provided by 'curly' for modern async/await usage. It returns a 'CurlyResult' upon completion. ```javascript // await curly.get(url, options) → CurlyResult ``` -------------------------------- ### HttpPostField Variants Examples Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/types.md Illustrates the different ways to define an HttpPostField for multipart/form-data uploads, including string content, file paths, and buffer data. ```typescript // String content { name: 'field1', contents: 'value' } // File from disk { name: 'file', file: '/path/to/file.txt', type: 'text/plain' } // Buffer content { name: 'data', fileContent: Buffer.from('data'), type: 'application/octet-stream' } ``` -------------------------------- ### Basic HTTP Request Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curl-class.md Demonstrates how to perform a basic HTTP GET request using the Curl class, including setting options like URL, follow location, and headers, and handling end and error events. ```APIDOC ## Basic HTTP Request ### Description Performs a basic HTTP GET request, setting essential options and handling response events. ### Method `new Curl()` followed by `setOpt()`, `on()`, and `perform()` ### Endpoint (Configured via `setOpt('URL', ...)`) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript const { Curl } = require('node-libcurl-ja3') const curl = new Curl() curl.setOpt('URL', 'https://api.example.com/data') .setOpt('FOLLOWLOCATION', true) .setOpt('HTTPHEADER', ['Accept: application/json']) curl.on('end', (statusCode, data, headers) => { console.log('Status:', statusCode) console.log('Data:', data) curl.close() }) curl.on('error', (error, errorCode) => { console.error('Error:', error, errorCode) curl.close() }) curl.perform() ``` ### Response #### Success Response (End Event) - **statusCode** (number) - The HTTP status code of the response. - **data** (string) - The response body. - **headers** (object) - The response headers. #### Error Response (Error Event) - **error** (string) - Description of the error. - **errorCode** (number) - The error code. ``` -------------------------------- ### Advanced Control with Curl API Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/README.md Illustrates how to use the advanced low-level 'Curl' API for fine-grained control over libcurl options. This example applies a Chrome browser fingerprint and sets basic request options before performing the request and handling events. ```typescript const { Curl, Browser, getCurlOptionsFromBrowser } = require('node-libcurl-ja3') const curl = new Curl() // Apply Chrome fingerprint const chromeOptions = getCurlOptionsFromBrowser(Browser.Chrome) Object.entries(chromeOptions).forEach(([key, value]) => { curl.setOpt(key, value) }) curl.setOpt('URL', 'https://example.com') curl.setOpt('FOLLOWLOCATION', true) curl.on('end', (statusCode, data, headers) => { console.log('Response:', statusCode, data.length, 'bytes') curl.close() }) curl.on('error', (error, errorCode) => { console.error('Error:', error) curl.close() }) curl.perform() ``` -------------------------------- ### Simple Request - Async/Await using curly Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/README.md Perform a simple GET request using the experimental 'curly' API. This API is subject to change. ```javascript const { curly } = require('node-libcurl-ja3'); const { statusCode, data, headers } = await curly.get('http://www.google.com') ``` -------------------------------- ### Easy Class Methods Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/easy-multi-share.md The Easy class inherits all methods from the native binding, providing low-level access to libcurl's easy interface for synchronous operations. Common methods include setting options, getting information, performing requests, and managing the handle. ```APIDOC ## Easy Class Methods ### Description Provides low-level access to libcurl's easy interface for synchronous operations. Common methods include setting options, getting information, performing requests, and managing the handle. ### Methods - **setOpt(option: number | string, value: any): CurlCode** - Sets a libcurl option for the handle. - **getInfo(info: number | string): { code: CurlCode; data: any }** - Retrieves information about the transfer. - **perform(): CurlCode** - Performs the libcurl request. This method is blocking. - **reset(): void** - Resets the easy handle. - **dupHandle(): EasyNativeBinding** - Duplicates the current easy handle. - **pause(bitmask: CurlPause): CurlCode** - Controls the transfer. - **upkeep(): CurlCode** - Performs connection upkeep. - **close(): void** - Closes and frees the easy handle. ### Static Methods - **strError(code: CurlCode): string** - Gets the string representation of a libcurl error code. - **getVersion(): string** - Gets the libcurl version string. ### Example Usage ```javascript const { Easy } = require('node-libcurl-ja3') const easy = new Easy() // This is BLOCKING - not recommended for async code easy.setOpt('URL', 'https://example.com') easy.setOpt('FOLLOWLOCATION', true) const code = easy.perform() if (code === 0) { const { code, data } = easy.getInfo('RESPONSE_CODE') console.log('Status:', data) } easy.close() ``` ### Note Most applications should use the `Curl` class (async/event-based) or `curly` API (promise-based) instead of Easy directly, as `Easy.perform()` is blocking. ``` -------------------------------- ### Event-Based Async Pattern Example Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/README.md Illustrates the event-based asynchronous pattern used by the 'Curl' class. This involves setting options, performing the request, and listening for 'end' or 'error' events. ```javascript // setOpt() → perform() → [async in background] → 'end'/'error' event ``` -------------------------------- ### Complete Workflow with Curly API Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/README.md Demonstrates a complete request-response cycle using the recommended high-level 'curly' API. This includes creating an impersonated client, making a GET request with custom headers and timeout, and handling the response or errors. ```typescript const { impersonate, Browser } = require('node-libcurl-ja3') // 1. Create impersonated client const chrome = impersonate(Browser.Chrome, { curlyBaseUrl: 'https://api.example.com' }) try { // 2. Make request const { data, statusCode, headers } = await chrome.get('/users', { httpHeader: ['Authorization: Bearer token'], timeout: 30 }) // 3. Handle response console.log(`Status: ${statusCode}`) console.log(data) // Auto-parsed JSON } catch (error) { // 4. Handle errors console.error(`Error ${error.code}: ${error.message}`) } ``` -------------------------------- ### Check Xcode Command Line Tools Installation Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/README.md Verifies if Xcode Command Line Tools are installed on macOS. ```sh xcode-select -p ``` -------------------------------- ### globalInit() Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curl-class.md Initializes the libcurl global environment. This is automatically called on module load unless disabled by an environment variable. It takes initialization flags as an argument and returns a CurlCode indicating success or failure. ```APIDOC ## globalInit() ### Description Initializes the libcurl global environment. This is automatically called on module load unless disabled by an environment variable. It takes initialization flags as an argument and returns a CurlCode indicating success or failure. ### Method `static` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **flags** (CurlGlobalInit) - Required - Initialization flags ### Response #### Success Response (0) - **CurlCode** (CurlCode) - Error code (0 on success) ### Source `lib/Curl.ts:122` ``` -------------------------------- ### Instance Option Setting and Information Retrieval Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/parseheaders.md Configure and query options for a specific libcurl handle. Use `handle.setOpt` to set parameters and `handle.getInfo` to retrieve status or configuration details. ```typescript handle.setOpt(optionName, optionValue) const result = handle.getInfo(infoName) ``` -------------------------------- ### Configure Multi Options Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/easy-multi-share.md Demonstrates setting common options for the Multi class, such as maximum connections and pipelining. ```javascript const { Multi } = require('node-libcurl-ja3') const multi = new Multi() // Set number of maximum connections multi.setOpt(Multi.option.MAXCONNECTS, 10) // Enable pipelining multi.setOpt(Multi.option.PIPELINING, 3) // Set max connections per host multi.setOpt(Multi.option.MAX_HOST_CONNECTIONS, 5) // Set max total connections multi.setOpt(Multi.option.MAX_TOTAL_CONNECTIONS, 20) ``` -------------------------------- ### Perform a Simple GET Request Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/INDEX.md Use `curly.get` for basic GET requests. It returns the status code and data from the response. ```typescript const { curly } = require('node-libcurl-ja3') const { data, statusCode } = await curly.get('https://example.com') console.log(statusCode, data) ``` -------------------------------- ### setUploadStream() Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curl-class.md Sets a stream to upload as request body. Internally sets the `READFUNCTION` callback. ```APIDOC ## setUploadStream() ### Description Sets a stream to upload as request body. Internally sets the `READFUNCTION` callback. ### Method `setUploadStream(stream: Readable | null): this` ### Parameters #### Path Parameters - **stream** (Readable | null) - Required - Stream to upload, or null to remove ### Throws `Error` — If stream is not a valid Readable ### Returns `this` — For method chaining ### Request Example ```typescript const fs = require('fs') const curl = new Curl() curl.setOpt('URL', 'https://example.com/upload') .setOpt('UPLOAD', true) .setOpt('HTTPHEADER', ['Transfer-Encoding: chunked']) .setUploadStream(fs.createReadStream('./file.zip')) .perform() ``` ### Remarks - Resets after each request - Pass `null` to remove the stream - Requires libcurl >= 7.69.1 for reliable stream support - Do not set `READFUNCTION` directly when using this method ``` -------------------------------- ### Build libcurl-impersonate Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/CONTRIBUTING.md Run this script if a pre-built binary is not available to build libcurl-impersonate from source. ```sh $ scripts/build.sh ``` -------------------------------- ### Publish Prerelease with np and npm Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/CONTRIBUTING.md If np fails with Yarn, use this command to skip cleanup and publish prereleases using npm. ```shell yarn np prerelease --no-yarn --no-cleanup --any-branch --tag next ``` -------------------------------- ### Basic GET Request with Default Curly Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curly.md Perform a basic GET request using the default 'curly' instance. Retrieves data, status code, and headers from the specified URL. ```typescript const { curly } = require('node-libcurl-ja3') const result = await curly.get('https://example.com') ``` -------------------------------- ### Basic HTTP GET Request Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curl-class.md Performs a basic HTTP GET request to a specified URL, following redirects and setting custom headers. Ensure the 'end' and 'error' events are handled for response processing and error management. ```typescript const { Curl } = require('node-libcurl-ja3') const curl = new Curl() curl.setOpt('URL', 'https://api.example.com/data') .setOpt('FOLLOWLOCATION', true) .setOpt('HTTPHEADER', ['Accept: application/json']) curl.on('end', (statusCode, data, headers) => { console.log('Status:', statusCode) console.log('Data:', data) curl.close() }) curl.on('error', (error, errorCode) => { console.error('Error:', error, errorCode) curl.close() }) curl.perform() ``` -------------------------------- ### TypeScript Enum Annotation Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/README.md Provides an example of defining an enum type in TypeScript. ```typescript // Enums enum CurlCode { CURLE_OK = 0, CURLE_FAILED_INIT = 2, ... } ``` -------------------------------- ### Set NOSIGNAL Option Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/configuration.md Use this option to prevent the installation of signal handlers, which is recommended for multithreaded code. ```typescript curl.setOpt('NOSIGNAL', true) ``` -------------------------------- ### Setting Curl Options Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/README.md Demonstrates the convention for setting libcurl options using the curl.setOpt() method. ```javascript curl.setOpt('OPTION', value) ``` -------------------------------- ### constructor() Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curl-class.md Creates a new Curl instance. Optionally clones an existing Easy handle. ```APIDOC ## constructor() ### Description Creates a new Curl instance. Optionally clones an existing Easy handle. ### Parameters #### Path Parameters - **cloneHandle** (EasyNativeBinding) - Optional - Existing Easy handle to clone ### Request Example ```typescript const curl = new Curl() // or clone an existing handle const clonedCurl = new Curl(existingHandle) ``` ``` -------------------------------- ### Get open handle count Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curl-class.md Returns the number of currently open handles in the internal Multi instance. ```typescript static getCount(): number ``` -------------------------------- ### Creating and Using a Certificate File Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/COMMON_ISSUES.md This snippet demonstrates how to create a certificate file from Node.js's `tls.rootCertificates` and then use it with `node-libcurl-ja3` by setting the `caInfo` option. This is useful when you need to specify a custom CA certificate bundle. ```javascript const fs = require('fs') const path = require('path') const tls = require('tls') const { curly } = require('node-libcurl-ja3') // important steps const certFilePath = path.join(__dirname, 'cert.pem') const tlsData = tls.rootCertificates.join(' ') fs.writeFileSync(certFilePath, tlsData) async function run() { return curly.post('https://httpbin.org/anything', { postFields: JSON.stringify({ a: 'b' }), httpHeader: ['Content-type: application/json'], caInfo: certFilePath, verbose: true, }) } run() .then(({ data, statusCode, headers }) console.log( require('util').inspect( { data: JSON.parse(data), statusCode, headers, }, null, 4, ), ) ) .catch((error) => console.error(`Something went wrong`, { error })) ``` -------------------------------- ### Get Edge Impersonation Config Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/impersonate.md Retrieves the impersonation configuration for the Edge browser. This allows your requests to appear as if they originated from Edge. ```typescript function getEdgeConfig(): ImpersonateConfig ``` -------------------------------- ### Set Custom HTTP Method Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/configuration.md Allows specifying a custom HTTP method for the request, overriding the default GET or POST. ```typescript curl.setOpt('CUSTOMREQUEST', 'PATCH') ``` -------------------------------- ### Handle libcurl Errors with CurlCode Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/types.md Example of how to use the CurlCode enum to check for specific error types emitted by a Curl instance. ```typescript const { Curl, CurlCode } = require('node-libcurl-ja3') curl.on('error', (error, errorCode) => { if (errorCode === CurlCode.CURLE_OPERATION_TIMEDOUT) { console.error('Request timed out') } else if (errorCode === CurlCode.CURLE_COULDNT_RESOLVE_HOST) { console.error('DNS failed') } else { console.error('Error:', errorCode, error.message) } }) ``` -------------------------------- ### Request with Query Parameters Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curly.md Append query parameters directly to the URL for GET requests. The 'followLocation' option is enabled to handle redirects. ```typescript const { curly } = require('node-libcurl-ja3') const { data } = await curly.get('https://api.example.com/search?q=test&limit=10', { followLocation: true }) ``` -------------------------------- ### Using Curl.option for Setting Options Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/parseheaders.md Demonstrates how to set cURL options using string names or the Curl.option enum. Lists common options and their numeric IDs. ```typescript const { Curl } = require('node-libcurl-ja3') // Both are equivalent curl.setOpt('URL', 'https://example.com') curl.setOpt(Curl.option.URL, 'https://example.com') // List common options const commonOptions = [ 'URL', 'FOLLOWLOCATION', 'HTTPHEADER', 'TIMEOUT', 'SSL_VERIFYPEER' ] commonOptions.forEach(optName => { console.log(`${optName}: ${Curl.option[optName]}`) }) ``` -------------------------------- ### Get Curl Options from Browser Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/impersonate.md Retrieves libcurl options to impersonate a specific browser. Ensure the browser is supported to avoid errors. ```typescript function getCurlOptionsFromBrowser(browser: Browser): CurlOptionValueType ``` -------------------------------- ### Publish Release with Yarn Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/CONTRIBUTING.md If 'np' encounters issues, use 'yarn publish' as an alternative for publishing releases. ```bash yarn publish ``` -------------------------------- ### setOpt() Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curl-class.md Sets a libcurl option on the handle. Supports both string names and numeric IDs. ```APIDOC ## setOpt() ### Description Sets a libcurl option on the handle. Supports both string names and numeric IDs. ### Method `setOpt(optionIdOrName: CurlOptionName, optionValue: CurlOptionValueType): this` ### Parameters #### Path Parameters - **optionIdOrName** (string | number) - Required - Option name or ID (e.g., 'URL' or Curl.option.URL) - **optionValue** (various) - Required - Value type depends on the option ### Throws `Error` — If option is unknown or value type is invalid ### Returns `this` — For method chaining ### Request Example ```typescript curl.setOpt('URL', 'https://example.com') .setOpt(Curl.option.FOLLOWLOCATION, true) .setOpt('HTTPHEADER', ['Accept: application/json']) .perform() ``` ``` -------------------------------- ### Global Initialization and Cleanup Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/parseheaders.md Perform global initialization for libcurl features and ensure proper cleanup. Use `Curl.globalInit` before any other libcurl operations and `Curl.globalCleanup` when done. ```typescript Curl.globalInit(CurlGlobalInit.All) Curl.globalCleanup() ``` -------------------------------- ### Easy Multi Share Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/INDEX.md Reference for low-level libcurl wrapper classes: Easy, Multi, and Share, used for synchronous operations, asynchronous handle management, and data sharing. ```APIDOC ## Easy Multi Share ### Description Reference for low-level libcurl wrapper classes. ### Easy Class Synchronous easy handle operations, static methods (`strError()`, `getVersion()`) ### Multi Class Asynchronous handle management, event callbacks, options ### Share Class Data sharing between handles (cookies, DNS, SSL sessions) ### Module Paths - `lib/Easy.ts` - `lib/Multi.ts` - `lib/Share.ts` ### Additional Information - Comparison table and recommendations ``` -------------------------------- ### Proxy Configuration Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curly.md Shows how to configure proxy settings for requests, including the proxy address and authentication credentials. ```APIDOC ## Proxy Configuration Configures proxy settings for requests. ### Method `GET` ### Endpoint `https://example.com` ### Parameters - **url** (string) - Required - The URL to fetch. - **options** (CurlyOptions) - Required - Options for the request. - **proxy** (string) - Required - The proxy server address (e.g., 'http://proxy.example.com:8080'). - **proxyAuth** (string) - Optional - Proxy authentication credentials (e.g., 'username:password'). ### Response - **data** (any) - The response body. ### Example ```typescript const { curly } = require('node-libcurl-ja3') const { data } = await curly.get('https://example.com', { proxy: 'http://proxy.example.com:8080', proxyAuth: 'username:password' }) ``` ``` -------------------------------- ### Retrieve request information Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curl-class.md Get details about the last performed request. Supports option names or numeric IDs for various information types. ```typescript const statusCode = curl.getInfo('RESPONSE_CODE') const totalTime = curl.getInfo(Curl.info.TOTAL_TIME) const effectiveUrl = curl.getInfo('EFFECTIVE_URL') const certChain = curl.getInfo(Curl.info.CERT_CHAIN) ``` -------------------------------- ### Get Safari Impersonation Config Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/impersonate.md Fetches the impersonation configuration for the Safari browser. This is useful for testing or scenarios requiring Safari-like client identification. ```typescript function getSafariConfig(): ImpersonateConfig ``` -------------------------------- ### Publish Release with npm Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/CONTRIBUTING.md As a fallback if 'yarn' has issues, use 'npm version' to set the version and 'npm publish' to release. ```bash npm version [major|minor|patch] npm publish ``` -------------------------------- ### Get Curl Options from Browser Config Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/impersonate.md Converts a custom ImpersonateConfig object into libcurl options. This allows for fine-grained control over impersonation settings. ```typescript function getCurlOptionsFromBrowserConfig(config: ImpersonateConfig): CurlOptionValueType ``` -------------------------------- ### Get libcurl Version Information Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/parseheaders.md Retrieves detailed version information about the linked libcurl library. Also provides a numerical representation of the version. ```typescript const { Curl } = require('node-libcurl-ja3') const version = Curl.getVersion() // Example: "libcurl/8.15.0-IMPERSONATE BoringSSL zlib/1.3.1 brotli/1.1.0 ..." const versionNum = Curl.VERSION_NUM // Example: 0x080f00 (8.15.0 as hex) ``` -------------------------------- ### Setting Multi Handle Options Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/types.md Shows how to configure options for a Multi handle, which manages multiple Curl transfers. Use `Multi.setOpt()` with appropriate constants. ```typescript const { Multi } = require('node-libcurl-ja3') const multi = new Multi() multi.setOpt(Multi.option.MAXCONNECTS, 10) multi.setOpt(Multi.option.PIPELINING, 3) ``` -------------------------------- ### Documentation File Structure Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/INDEX.md Overview of the documentation files within the /output directory. Each file covers a specific aspect of the library. ```markdown /output/ ├── INDEX.md # This file ├── types.md # Type definitions ├── configuration.md # Options and env vars ├── errors.md # Error codes and handling └── api-reference/ ├── curl-class.md # Curl class reference ├── curly.md # Curly API reference ├── impersonate.md # Impersonation reference └── easy-multi-share.md # Low-level classes reference ``` -------------------------------- ### Create a Curly Instance with Default Options Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curly.md Use the `create` function to instantiate a curly client with predefined default options, such as base URL and headers, which will be applied to all subsequent requests made with that instance. ```typescript const { curly } = require('node-libcurl-ja3') // Create authenticated client const apiClient = curly.create({ curlyBaseUrl: 'https://api.example.com/v1', httpHeader: [ 'Authorization: Bearer ' + process.env.API_TOKEN, 'Content-Type: application/json' ] }) const users = await apiClient.get('/users') const user = await apiClient.post('/users', { postFields: JSON.stringify({ name: 'New User' }) }) ``` -------------------------------- ### create() Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curly.md Creates a new curly instance with default options applied to all requests. This is useful for setting base URLs, authentication headers, or other common configurations for multiple API calls. ```APIDOC ## create() ### Description Creates a new curly instance with default options applied to all requests. ### Method Signature ```typescript function create(defaultOptions?: CurlyOptions): CurlyFunction ``` ### Parameters #### defaultOptions - **defaultOptions** (CurlyOptions) - Required - Options applied to every request ### Returns - **CurlyFunction** - A new curly instance with default options. ### Example ```javascript const { curly } = require('node-libcurl-ja3') // Create authenticated client const apiClient = curly.create({ curlyBaseUrl: 'https://api.example.com/v1', httpHeader: [ 'Authorization: Bearer ' + process.env.API_TOKEN, 'Content-Type: application/json' ] }) const users = await apiClient.get('/users') const user = await apiClient.post('/users', { postFields: JSON.stringify({ name: 'New User' }) }) ``` ``` -------------------------------- ### Get Connection Info with Request Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/curly.md Retrieve detailed connection information, such as total time, effective URL, and content length, by enabling the `curlyGetInfo` option. ```typescript const { curly } = require('node-libcurl-ja3') const { statusCode, info } = await curly.get('https://example.com', { curlyGetInfo: true }) console.log(info.TOTAL_TIME) console.log(info.EFFECTIVE_URL) console.log(info.CONTENT_LENGTH) ``` -------------------------------- ### Get Firefox Impersonation Config Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/impersonate.md Obtain the impersonation configuration specific to the Firefox browser. Use this to set request headers and other properties to match Firefox. ```typescript function getFirefoxConfig(): ImpersonateConfig ``` -------------------------------- ### Publish Release with np Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/CONTRIBUTING.md Use the 'np' tool to publish a new release to npm. Specify 'major', 'minor', or 'patch' for version bumping. ```bash npx np [major|minor|patch] ``` -------------------------------- ### Configuring Multi Handle Options Source: https://github.com/andrewmackrodt/node-libcurl-ja3/blob/develop/_autodocs/api-reference/parseheaders.md Illustrates how to set performance-related options for a Multi handle using the Multi.option enum. ```typescript const { Multi } = require('node-libcurl-ja3') const multi = new Multi() // Set performance options multi.setOpt(Multi.option.MAXCONNECTS, 10) multi.setOpt(Multi.option.PIPELINING, 1) multi.setOpt(Multi.option.MAX_HOST_CONNECTIONS, 5) ```