{"id":14990072,"url":"https://github.com/rfrench/curler","last_synced_at":"2025-04-12T02:03:57.295Z","repository":{"id":3228259,"uuid":"4263885","full_name":"rfrench/curler","owner":"rfrench","description":"A native c++ node.js module for asynchronous http requests via libcurl.","archived":false,"fork":false,"pushed_at":"2017-11-03T02:44:48.000Z","size":16,"stargazers_count":19,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T02:03:52.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/rfrench.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}},"created_at":"2012-05-08T18:23:26.000Z","updated_at":"2023-09-03T03:21:10.000Z","dependencies_parsed_at":"2022-07-10T20:17:00.903Z","dependency_job_id":null,"html_url":"https://github.com/rfrench/curler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rfrench%2Fcurler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rfrench%2Fcurler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rfrench%2Fcurler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rfrench%2Fcurler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rfrench","download_url":"https://codeload.github.com/rfrench/curler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505863,"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":[],"created_at":"2024-09-24T14:19:25.060Z","updated_at":"2025-04-12T02:03:57.277Z","avatar_url":"https://github.com/rfrench.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# curler\nA native c++ node.js module for asynchronous http requests via libcurl.\n\n## Install\n\u003cpre\u003e\n  $ npm install curler\n\u003c/pre\u003e\n\n## request(options, callback[err, res, bodyData])\n\n### Options\n - `url`: request url. (required)\n - `method`: HTTP method type. Defaults to `GET`. (can be anything)\n - `headers`: Optional JSON key/value array of the request headers.\n - `userAgent`: Optional custom user agent.\n - `proxy`: Optional proxy support. (i.e. http://proxy.example.com:80)\n - `data`: Optional request body data.\n - `timeout`: Total request timeout (connection/response) in milliseconds.\n - `connectionTimeout`: Connection timeout in milliseconds.\n\n## Examples\n\n### GET request\n``` js\nvar curler = require(\"curler\").Curler;\nvar curl = new curler();\n\nvar options = {\n  method: \"GET\",\n  url: 'http://www.google.com'\n};\n\nvar startDate = Date.now();\ncurl.request(options, function(err, res, bodyData) {\n  var duration = (Date.now() - startDate);\n  if (err) {\n    console.log(err);\n  }\n  else {\n    console.log('statusCode: %s', res.statusCode);\n    console.log('bodyData: %s', bodyData);\n  }\n\n  console.log(\"curler (libcurl) performed http request in %s ms. dnsTime: %s, connectTime: %s, preTransferTime: %s, startTransferTime: %s, totalTime: %s\", duration, res.dnsTime, res.connectTime, res.preTransferTime, res.startTransferTime, res.totalTime);\n});\n```\n\n### POST request (body data)\n``` js\nvar curler = require(\"curler\").Curler;\nvar curl = new curler();\n\nvar data = JSON.stringify({ hello: 'world' });\n\nvar options = {\n  method: \"POST\",\n  url: 'http://www.example.com/',\n  userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3',\n  headers: {\n    'Content-Type': 'application/json',\n    'Connection': 'Keep-Alive'\n  },\n  data: data,\n  timeout: 5000,\n  connectionTimeout: 5000\n};\n\nvar startDate = Date.now();\ncurl.request(options, function(err, res, bodyData) {\n  var duration = (Date.now() - startDate);\n  if (err) {\n    console.log(err);\n  }\n  else {\n    console.log('statusCode: %s', res.statusCode);\n    console.log('bodyData: %s', bodyData);\n  }\n\n  console.log(\"curler (libcurl) performed http request in %s ms. dnsTime: %s, connectTime: %s, preTransferTime: %s, startTransferTime: %s, totalTime: %s\", duration, res.dnsTime, res.connectTime, res.preTransferTime, res.startTransferTime, res.totalTime);\n});\n```\n\n## TODO\n- Allow Expect: 100-Continue to be configurable, rather than always off\n- Load a queue of curl handles when the module loads (ghetto connection pooling). Need a deconstructor in curler.cc that works first!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frfrench%2Fcurler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frfrench%2Fcurler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frfrench%2Fcurler/lists"}