{"id":14989974,"url":"https://github.com/nktnet1/sync-request-curl","last_synced_at":"2025-04-12T02:03:19.821Z","repository":{"id":185274277,"uuid":"673289432","full_name":"nktnet1/sync-request-curl","owner":"nktnet1","description":"Make synchronous web requests similar to sync-request, but 20 times more quickly.  Leverages node-libcurl for performance instead of spawning child processes like sync-request.  This library was designed to run on NodeJS. It will not work in a browser.","archived":false,"fork":false,"pushed_at":"2024-12-27T01:10:28.000Z","size":8004,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T02:03:04.181Z","etag":null,"topics":["comp1531","curl","fast","http","https","libcurl","node-libcurl","performance","quick","request","speed","sync","sync-request","synchronous"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sync-request-curl","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nktnet1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-01T09:47:15.000Z","updated_at":"2024-12-27T01:11:55.000Z","dependencies_parsed_at":"2024-04-11T18:32:25.992Z","dependency_job_id":"9078f2eb-9376-472c-a2bc-ebf5877b080e","html_url":"https://github.com/nktnet1/sync-request-curl","commit_stats":{"total_commits":326,"total_committers":8,"mean_commits":40.75,"dds":0.5337423312883436,"last_synced_commit":"f31b0e833b8572b9a2f358008bb3d78269b69568"},"previous_names":["nktnet1/sync-request-curl"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nktnet1%2Fsync-request-curl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nktnet1%2Fsync-request-curl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nktnet1%2Fsync-request-curl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nktnet1%2Fsync-request-curl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nktnet1","download_url":"https://codeload.github.com/nktnet1/sync-request-curl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505855,"owners_count":21115354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comp1531","curl","fast","http","https","libcurl","node-libcurl","performance","quick","request","speed","sync","sync-request","synchronous"],"created_at":"2024-09-24T14:19:15.724Z","updated_at":"2025-04-12T02:03:19.785Z","avatar_url":"https://github.com/nktnet1.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n\n# [![Sync Request Curl](logo.svg)](https://github.com/nktnet1/sync-request-curl)\n\n[![pipeline](https://github.com/nktnet1/sync-request-curl/actions/workflows/pipeline.yml/badge.svg)](https://github.com/nktnet1/sync-request-curl/actions/workflows/pipeline.yml)\n\u0026nbsp;\n[![codecov](https://codecov.io/gh/nktnet1/sync-request-curl/branch/main/graph/badge.svg?token=RAC7SKJTGU)](https://codecov.io/gh/nktnet1/sync-request-curl)\n\u0026nbsp;\n[![Maintainability](https://api.codeclimate.com/v1/badges/3ec8c0ddebe848926277/maintainability)](https://codeclimate.com/github/nktnet1/sync-request-curl/maintainability)\n\u0026nbsp;\n[![Snyk Security](https://snyk.io/test/github/nktnet1/sync-request-curl/badge.svg)](https://snyk.io/test/github/nktnet1/sync-request-curl)\n\u0026nbsp;\n[![GitHub top language](https://img.shields.io/github/languages/top/nktnet1/sync-request-curl)](https://github.com/search?q=repo%3Anktnet1%2Fsync-request-curl++language%3ATypeScript\u0026type=code)\n\n[![NPM Version](https://img.shields.io/npm/v/sync-request-curl?logo=npm)](https://www.npmjs.com/package/sync-request-curl?activeTab=versions)\n\u0026nbsp;\n[![install size](https://packagephobia.com/badge?p=sync-request-curl)](https://packagephobia.com/result?p=sync-request-curl)\n\u0026nbsp;\n[![Depfu Dependencies](https://badges.depfu.com/badges/6c4074c4d23ad57ee2bfd9ff90456090/overview.svg)](https://depfu.com/github/nktnet1/sync-request-curl?project_id=39032)\n\u0026nbsp;\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fnktnet1%2Fsync-request-curl.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fnktnet1%2Fsync-request-curl?ref=badge_shield)\n\u0026nbsp;\n[![NPM License](https://img.shields.io/npm/l/sync-request-curl)](https://opensource.org/license/mit/)\n\u0026nbsp;\n[![GitHub issues](https://img.shields.io/github/issues/nktnet1/sync-request-curl.svg?style=social)](https://github.com/nktnet1/sync-request-curl/issues)\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nktnet1_sync-request-curl\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=nktnet1_sync-request-curl)\n\u0026nbsp;\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/f222c2e572fc41b7b45c3591c3575a9d)](https://app.codacy.com/gh/nktnet1/sync-request-curl/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n\u0026nbsp;\n[![DeepSource](https://app.deepsource.com/gh/nktnet1/sync-request-curl.svg/?label=active+issues\u0026show_trend=true\u0026token=OTP6tE2be4X1kvxZRsxRh25e)](https://app.deepsource.com/gh/nktnet1/sync-request-curl/)\n\u0026nbsp;\n[![codebeat badge](https://codebeat.co/badges/8bdb4562-0492-4c1c-8b02-e69c94373d60)](https://codebeat.co/projects/github-com-nktnet1-sync-request-curl-main)\n\u0026nbsp;\n[![GitHub stars](https://img.shields.io/github/stars/nktnet1/sync-request-curl.svg?style=social)](https://github.com/nktnet1/sync-request-curl/stargazers)\n\n[![Downloads Total](https://badgen.net/npm/dt/sync-request-curl)](https://moiva.io/?npm=sync-request-curl)\n\u0026nbsp;\n[![Downloads Yearly](https://badgen.net/npm/dy/sync-request-curl)](https://moiva.io/?npm=sync-request-curl)\n\u0026nbsp;\n[![Downloads Monthly](https://badgen.net/npm/dm/sync-request-curl)](https://moiva.io/?npm=sync-request-curl)\n\u0026nbsp;\n[![Downloads Weekly](https://badgen.net/npm/dw/sync-request-curl)](https://moiva.io/?npm=sync-request-curl)\n\u0026nbsp;\n[![Downloads Daily](https://badgen.net/npm/dd/sync-request-curl)](https://moiva.io/?npm=sync-request-curl)\n\n---\n\nMake synchronous web requests similar to [sync-request](https://github.com/ForbesLindesay/sync-request), but 20 times more quickly.\n\nLeverages [node-libcurl](https://github.com/JCMais/node-libcurl) for performance instead of spawning child processes like sync-request.\n\nThis library was designed to run on NodeJS. It will not work in a browser.\n\n[![Try with Replit](https://replit.com/badge?caption=Try%20with%20Replit)](https://replit.com/@nktnet1/sync-request-curl-example#index.js)\n\n\u003c/div\u003e\n\n---\n\n- [1. Installation](#1-installation)\n- [2. Usage](#2-usage)\n    - [2.1. Method](#21-method)\n    - [2.2. URL](#22-url)\n    - [2.3. Options](#23-options)\n    - [2.4. Response](#24-response)\n    - [2.5. Errors](#25-Errors)\n- [3. License](#3-license)\n- [4. Compatibility](#4-compatibility)\n    - [4.1. Windows](#41-windows)\n    - [4.2. MacOS](#42-macos)\n    - [4.3. Linux](#43-linux)\n- [5. Caveats](#5-caveats)\n\n## 1. Installation\n\n```\nnpm install sync-request-curl\n```\n\nPlease refer to the [compatibility](#4-compatibility) section for known issues and workarounds for Windows, MacOS and Linux.\n\n## 2. Usage\n\nTry with [Replit](https://replit.com/@nktnet1/sync-request-curl-example#index.js).\n\n```typescript\nrequest(method, url, options);\n```\n\n\u003cdetails closed\u003e\n\u003csummary\u003eExamples (click to view)\u003c/summary\u003e\n\n\u003cbr/\u003e\n\n`GET` request without options\n\n```typescript\nimport request from 'sync-request-curl';\n\nconst res = request(\n  'GET',\n  'https://comp1531namesages.alwaysdata.net'\n);\nconsole.log('Status Code:', res.statusCode);\nconst jsonBody = JSON.parse(res.body.toString());\nconsole.log('Returned JSON object:', jsonBody);\n```\n\n**`GET`** request with query string parameters\n\n```typescript\nimport request from 'sync-request-curl';\n\nconst res = request(\n  'GET',\n  'https://comp1531forum.alwaysdata.net/echo/echo',\n  {\n    qs: { message: 'Hello, world!' },\n  }\n);\nconsole.log('Status Code:', res.statusCode);\nconst jsonBody = JSON.parse(res.body.toString());\nconsole.log('Returned JSON object:', jsonBody);\n```\n\n**`POST`** request with headers and JSON payload\n\n```typescript\nimport request from 'sync-request-curl';\n\nconst res = request(\n  'POST',\n  'https://comp1531quiz.alwaysdata.net/quiz/create',\n  {\n    headers: { lab08quizsecret: \"bruno's fight club\" },\n    json: {\n      quizTitle: 'New Quiz',\n      quizSynopsis: 'Sync request curl example'\n    },\n  }\n);\nconsole.log('Status Code:', res.statusCode);\nconst jsonBody = JSON.parse(res.body.toString());\nconsole.log('Returned JSON Object:', jsonBody);\n```\n\nUsing a proxy URL (Note: replace with your own proxy details)\n```javascript\nimport request from 'sync-request-curl';\n\nconst res = request(\n  'GET',\n  'https://ipinfo.io/json',\n  {\n    setEasyOptions: (curl, options) =\u003e {\n      curl.setOpt(options.PROXY, 'http://your-proxy-url:port');\n      curl.setOpt(options.PROXYUSERPWD, 'proxyUsername:proxyPassword');\n    },\n  }\n);\n\nconsole.log('Status Code:', res.statusCode);\nconst jsonBody = JSON.parse(res.body.toString());\nconsole.log(jsonBody);\n```\n\n\u003c/details\u003e\n\n\u003cbr/\u003e\n\n### 2.1. Method\n\nHTTP method (of type `HttpVerb`)\n- e.g. `PUT`/`POST`/`GET`/`DELETE`\n\nNote that for the `HEAD` method, [CURLOPT_NOBODY](https://curl.se/libcurl/c/CURLOPT_NOBODY.html) is set to `true` automatically by **sync-request-curl**.\n\n### 2.2. URL\n\nURL as a string\n- e.g. https://toohak.fly.dev\n\n### 2.3. Options\n\nOnly the following options from [sync-request](https://www.npmjs.com/package/sync-request) are supported for the time being:\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003eOption\u003c/th\u003e\n    \u003cth\u003eDescription\u003c/th\u003e\n    \u003cth\u003eExample\u003c/th\u003e\n    \u003cth\u003eDefault\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eqs\u003c/td\u003e\n    \u003ctd\u003e\n      An object containing query string parameters which will be appended to the URL.\n    \u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n{\n  message: 'Hi!'\n}\n\u003c/pre\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eundefined\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eheaders\u003c/td\u003e\n    \u003ctd\u003e\n      HTTP headers for the request.\n    \u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n{\n  token: 'abcde'\n}\n\u003c/pre\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eundefined\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ejson\u003c/td\u003e\n    \u003ctd\u003e\n      Sets the body as a JSON representation of the value and automatically adds \u003ccode\u003eContent-type: application/json\u003c/code\u003e to the header.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e{\n  name: 'Tam',\n  course: 1531\n}\u003c/pre\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eundefined\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ebody\u003c/td\u003e\n    \u003ctd\u003e\n      String body for PATCH, POST and PUT requests. We recommended using \u003ccode\u003ejson\u003c/code\u003e instead for JSON payloads, otherwise the \u003ccode\u003eContent-Type\u003c/code\u003e will need to be set manually.\n    \u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\nJSON.stringify({\n  name: 'Tam',\n  course: 1531\n}) \u003c/pre\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eundefined\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003etimeout\u003c/td\u003e\n    \u003ctd\u003e\n      Times out if no response is returned within the given number of milliseconds.\n    \u003c/td\u003e\n    \u003ctd\u003e\u003cpre\u003e2000\u003c/pre\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003e0\u003c/code\u003e\u003cbr/\u003e(no timeout)\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003efollowRedirects\u003c/td\u003e\n    \u003ctd\u003e\n      Sets whether redirects (status code 302) should be followed automatically.\n    \u003c/td\u003e\n    \u003ctd\u003e\u003cpre\u003efalse\u003c/pre\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003emaxRedirects\u003c/td\u003e\n    \u003ctd\u003eSets the maximum number of redirects to follow before throwing an Error.\u003c/td\u003e\n    \u003ctd\u003e\u003cpre\u003e3\u003c/pre\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003e-1\u003c/code\u003e\u003cbr/\u003e(no limit)\u003c/td\u003e\n  \u003c/tr\u003e\n\n\u003c/table\u003e\n\n\u003cbr/\u003e\n\nBelow are some additional options available from [node-libcurl](https://github.com/JCMais/node-libcurl):\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003eOption\u003c/th\u003e\n    \u003cth\u003eDescription\u003c/th\u003e\n    \u003cth\u003eExample\u003c/th\u003e\n    \u003cth\u003eDefault\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003einsecure\u003c/td\u003e\n    \u003ctd\u003e Set to true to send insecure requests. This can be useful on Windows which may have SSL issues (Libcurl code 60).\u003c/td\u003e\n    \u003ctd\u003e\u003cpre\u003etrue\u003c/pre\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003esetEasyOptions\u003c/td\u003e\n    \u003ctd\u003eOptional callback to set additional curl options for the \u003ca href='https://curl.se/libcurl/c/easy_setopt_options.html' target=\"_blank\"\u003eEasy Interface\u003c/a\u003e. This has priority over existing options.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n(curl, opt) =\u003e {\n  curl.setOpt(\n    opt.URL,\n    'www.ck'\n  );\n}\n\u003c/pre\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eundefined\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cbr/\u003e\n\nIn [src/types.ts](src/types.ts), the `Options` interface following is defined as:\n\n```typescript\nexport interface Options {\n  /*\n   * sync-request options\n   */\n  headers?: IncomingHttpHeaders;\n  qs?: { [key: string]: any };\n  json?: any;\n  body?: string | Buffer;\n\n  timeout?: number;\n  followRedirects?: boolean;\n  maxRedirects?: number;\n\n  /*\n   * node-libcurl options\n   */\n  insecure?: boolean;\n  setEasyOptions?: SetEasyOptionCallback;\n}\n```\n\n### 2.4. Response\n\n- **`statusCode`** - a number representing the HTTP status code (e.g. `200`, `400`, `401`, `403`)\n- **`headers`** - HTTP response headers. The keys/properties of the object will always be in lowercase, e.g. `\"content-type\"` instead of `\"Content-Type\"`\n- **`body`** - a string or buffer - for JSON responses, use `JSON.parse(response.body.toString())` to get the returned data as an object\n- **`getBody`** - a function with an optional `encoding` argument that returns the `body` if `encoding` is undefined, otherwise `body.toString(encoding)`. If `statusCode \u003e= 300`, an `Error` is thrown instead\n- **`url`** - the final URL used in the request after all redirections are followed, and with the query string parameters appended\n\nIn [src/types.ts](src/types.ts), the `Response` interface is defined as:\n\n```typescript\nexport interface Response {\n  statusCode: number;\n  headers: IncomingHttpHeaders;\n  body: string | Buffer;\n  getBody: (encoding?: BufferEncoding) =\u003e string | Buffer; // simplified\n  url: string;\n}\n```\n\n### 2.5. Errors\n\nWhen using the `response.getBody()` function, a generic [Error](https://nodejs.org/api/errors.html) object is thrown.\n\nIf there are issues with the request, a `CurlError` will be thrown. This will contain a non-zero `code` property that corresponds to a specific Libcurl Error from this documentation:\n- https://curl.se/libcurl/c/libcurl-errors.html\n\nA few common errors are:\n\n1. CURLE_COULDNT_CONNECT (7)\n    - Failed to connect() to host or proxy.\n    - **HINT**: This means that the server could not be reached. For local development (e.g. in testing), ensure that your server has started successfully, or that it did not crash while handling a previous request\n1. CURLE_URL_MALFORMAT (3)\n    - The URL was not properly formatted.\n    - **HINT**: The request was not successful because your input URL is invalid, e.g. missing domain, protocol or port. Try printing out your input URL, or if it is a GET request, access it directly in a browser\n1. CURLE_PEER_FAILED_VERIFICATION (60)\n    - The remote server's SSL certificate or SSH fingerprint was deemed not OK. This error code has been unified with CURLE_SSL_CACERT since 7.62.0. Its previous value was 51\n    - **HINT**: See the [Windows](#41-windows) compatibility section for an explanation and potential workaround\n\nIt is possible to check the cURL code as follows:\n\n\u003cdetails closed\u003e\n\u003csummary\u003eExample (click to view)\u003c/summary\u003e\n\n```typescript\nimport request, { CurlError } from 'sync-request-curl';\n\ntry {\n  request('GET', 'https://google.fake.url.com');\n} catch (error) {\n  if (error instanceof CurlError) {\n    // outputs 6 (CURLE_COULDNT_RESOLVE_HOST)\n    console.log(error.code);\n  }\n}\n```\n\n\u003c/details\u003e\n\nIn [src/errors.ts](src/errors.ts), the `CurlError` class is defined as:\n\n```typescript\nexport class CurlError extends Error {\n  // https://curl.se/libcurl/c/libcurl-errors.html\n  code: number;\n  constructor(code: number, message: string) {\n    super(message);\n    if (code \u003c 1 || code \u003e 99) {\n      throw new Error(`CurlError code must be between 1 and 99. Given: ${code}`);\n    }\n    this.code = code;\n    Object.setPrototypeOf(this, CurlError.prototype);\n  }\n}\n```\n\n\n## 3. License\n\n\u003cdetails closed\u003e\n\u003csummary\u003eMassachusetts Institute of Technology (\u003ca href=\"https://opensource.org/license/mit\" target=\"_blank\"\u003eMIT\u003c/a\u003e)\u003c/summary\u003e\n\n\u003cbr/\u003e\n\n```\nCopyright (c) 2023 Khiet Tam Nguyen\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the “Software”),\nto deal in the Software without restriction, including without limitation\nthe rights to use, copy, modify, merge, publish, distribute, sublicense,\nand/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\nTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n```\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fnktnet1%2Fsync-request-curl.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fnktnet1%2Fsync-request-curl?ref=badge_large)\n\n\u003c/details\u003e\n\n## 4. Compatibility\n\n### 4.1. Windows\n\nFor installation issues, be sure to review the [Windows Build Requirements](https://github.com/JCMais/node-libcurl#building-on-windows) from node-libcurl's documentation.\n\nIn addition, your requests may unexpectedly fail with a [Libcurl Error](https://curl.se/libcurl/c/libcurl-errors.html) (code 60, CURLE_PEER_FAILED_VERIFICATION) when using NodeJS natively on Windows.\n\nThe reason is covered in the below resources:\n- https://github.com/JCMais/node-libcurl/issues/301\n- https://stackoverflow.com/a/34883260/22324694\n\nOne quick workaround is to set the `insecure` option to `true` when sending your requests. This is the same as setting the Libcurl Easy's equivalent [SSL_VERIFYPEER](https://curl.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html) to `0`, or using `curl` in the command line with the [`-k` or `--insecure`](https://curl.se/docs/manpage.html#-k) option.\n\nAlternatively, consider using [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install).\n\n### 4.2. MacOS\n\nThe build for MacOS may fail during the installation process.\n\nIn most cases, this can be fixed by following these Github issues:\n- https://github.com/JCMais/node-libcurl/issues/296\n- https://github.com/JCMais/node-libcurl/issues/382\n\nand carefully reviewing the [MacOS Build Requirements](https://github.com/JCMais/node-libcurl#building-on-macos) from node-libcurl's documentation. Otherwise, we recommend uninstalling this library and installing [sync-request](https://github.com/JCMais/node-libcurl/issues/382).\n\n### 4.3. Linux\n\nIn rare cases, the build for distributions such as Debian or Ubuntu may fail. This is attributed to missing dependencies such as Python or Libcurl. Below are some related issues:\n- https://github.com/JCMais/node-libcurl/issues/374\n- https://github.com/JCMais/node-libcurl/issues/376\n\nBe sure to also check the [Linux Build Requirements](https://github.com/JCMais/node-libcurl#building-on-linux) from node-libcurl's documentation.\n\n## 5. Caveats\n\nSee [sync-request](https://www.npmjs.com/package/sync-request) for the original documentation. Please note that **sync-request-curl** only supports a subset of the original features in sync-request and additional features through leveraging [node-libcurl](https://www.npmjs.com/package/node-libcurl).\n\n**sync-request-curl** was developed to improve performance with sending synchronous requests in NodeJS. It is also free from the sync-request bug which leaves an orphaned sync-rpc process, resulting in a [leaked handle being detected in Jest](https://github.com/ForbesLindesay/sync-request/issues/129).\n\n**sync-request-curl** was designed to work with UNIX-like systems for UNSW students enrolled in [COMP1531 Software Engineering Fundamentals](https://webcms3.cse.unsw.edu.au/COMP1531/23T2/outline). It has been tested on Alpine, Arch, Debian and Ubuntu Linux and is compatible with Windows/MacOS.\n\nPlease note that this library's primary goal is to simplify the learning of JavaScript for novice programmers, hence its synchronous nature. However, we recommend to **always use an [asynchronous alternative](https://blog.appsignal.com/2024/09/11/top-5-http-request-libraries-for-nodejs.html)** where possible.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnktnet1%2Fsync-request-curl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnktnet1%2Fsync-request-curl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnktnet1%2Fsync-request-curl/lists"}