{"id":22310306,"url":"https://github.com/Rahuletto/simply-https","last_synced_at":"2025-07-29T07:32:54.532Z","repository":{"id":171859536,"uuid":"648516011","full_name":"Rahuletto/simply-https","owner":"Rahuletto","description":"A light weight yet an efficient https module to make api requests","archived":false,"fork":false,"pushed_at":"2024-01-02T07:23:01.000Z","size":47,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-19T06:52:42.557Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rahuletto.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-06-02T06:44:39.000Z","updated_at":"2025-04-28T23:53:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"91337517-18da-4784-92e0-45e87a47e779","html_url":"https://github.com/Rahuletto/simply-https","commit_stats":null,"previous_names":["rahuletto/simply-https"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Rahuletto/simply-https","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahuletto%2Fsimply-https","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahuletto%2Fsimply-https/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahuletto%2Fsimply-https/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahuletto%2Fsimply-https/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rahuletto","download_url":"https://codeload.github.com/Rahuletto/simply-https/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahuletto%2Fsimply-https/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267646054,"owners_count":24120931,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-12-03T21:01:15.139Z","updated_at":"2025-07-29T07:32:54.521Z","avatar_url":"https://github.com/Rahuletto.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# ⚡ simply-https\n\nA light weight yet an efficient HTTPS module to make API requests\n\n\u003e [!IMPORTANT]\n\u003e Welcome to v2.0.0\n\u003e\n\u003e ## What's new?\n\u003e\n\u003e - New syntax to make it easy to switch from node-fetch or vanilla fetch() to simply-https\n\u003e - Faster, Efficient, More Type strict.\n\u003e - Supports [various types](#response) for response\n\u003e - Fully supports all [HTTPS methods](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)\n\u003e - Less bloat.\n\n## Functions\n\n- [https()](#https)\n\n### https()\n\nHttps function to replace your good ol' node-fetch and axios.\n\n```js\nconst { https } = require(\"simply-https\");\nhttps(\"url\", {\n  // options (optional)\n});\n```\n\n\u003e This returns a Promise so you should await it and should be located inside an `async` function. Or your project should be configured to [`top-level await`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#top_level_await)\n\nTypes:\n\n```ts\nhttps(\n  url: string,\n  options?: HttpsOptions\n): Promise\u003cobject | Buffer | string | Resolver | ArrayBuffer | Blob\u003e;\n```\n\n- url: [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\n- options: [`HttpsOptions`](#httpsoptions)\n\n- Resolves: `Promise\u003cobject | Buffer | string | Resolver | ArrayBuffer | Blob\u003e`\n\n## Options\n\n### `HttpsOptions`\n\n| Parameters     | Type                                                                                           | Default                                | Description                                                                                                                                                                               |\n| -------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `body`         | object \\| string (passed as JSON.stringify())                                                  |                                        | The body to send the request (cannot be used in 'GET' request)                                                                                                                            |\n| `url`          | string                                                                                         |                                        | The URL to call the API (if you are not using the second argument and not using hostname and endpoint options)                                                                            |\n| `hostname`     | string                                                                                         |                                        | The hostname of the url (Not necessary if URL argument has endpoint with it)                                                                                                              |\n| `endpoint`     | string                                                                                         |                                        | Endpoint to request to (Not necessary if URL argument has endpoint with it)                                                                                                               |\n| `headers`      | Record\u003cstring, string\u003e                                                                         | { \"Content-Type\": \"application/json\" } | The headers of the request                                                                                                                                                                |\n| `method`       | \"GET\" \\| \"POST\" \\| \"PUT\" \\| \"PATCH\" \\| \"DELETE\" \\| \"HEAD\" \\| \"CONNECT\" \\| \"OPTIONS\" \\| \"TRACE\" | GET                                    | The method of request to do with the URL                                                                                                                                                  |\n| `responseType` | \"json\" \\| \"stream\" \\| \"text\" \\| \"blob\" \\| \"arrayBuffer\" \\| \"buffer\"                            |                                        | Returns Resolver class where you can do .toJSON, .toString, .toBuffer, .toStream, .toBlob or Promised functions like .json(), .stream(), .text(), .blob() to support vanilla fetch syntax |\n| `statusCode`   | number                                                                                         | 200                                    | Expected status code                                                                                                                                                                      |\n| `timeout`      | number                                                                                         | 5000                                   | The time limit untill it gets HTTP Timeout                                                                                                                                                |\n\n```ts\ninterface HttpsOptions {\n  body?: object | string;\n  url?: string;\n  hostname?: string;\n  endpoint?: string;\n  headers?: Record\u003cstring, string\u003e;\n  method?:\n    | \"GET\"\n    | \"POST\"\n    | \"PUT\"\n    | \"PATCH\"\n    | \"DELETE\"\n    | \"HEAD\"\n    | \"CONNECT\"\n    | \"OPTIONS\"\n    | \"TRACE\";\n  responseType?: \"json\" | \"stream\" | \"text\" | \"blob\" | \"arrayBuffer\" | \"buffer\";\n  statusCode?: number;\n  timeout?: number;\n}\n```\n\n---\n\n### Response\n\nIt returns a `Resolver` class which contains\n\n\u003e Promise based functions\n\u003e\n\u003e - arrayBuffer() | array()\n\u003e - blob()\n\u003e - buffer() | stream()\n\u003e - json()\n\u003e - text() | string()\n\n\u003e Not Promise based\n\u003e\n\u003e - toArrayBuffer()\n\u003e - toBlob()\n\u003e - toBuffer() | toStream()\n\u003e - toJSON()\n\u003e - toText() | toString()\n\nThese functions are used to resolve your data stream into desired format.\nCan convert into\n[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)\n[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)\n[`Buffer`](https://developer.mozilla.org/en-US/docs/Glossary/Buffer)\n[`JSON`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON)\n[`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\n\n## Examples\n\n\u003cdetails\u003e\n  \u003csummary\u003eDefault mode\u003c/summary\u003e\n\nWith await\n\n```js title=\"https.js\"\nconst { https } = require(\"simply-https\");\n\n// should be inside a async function or have top-level await\nconst data = await https(\"postman-echo.com/get\");\nconst res = await res.json();\nconsole.log(res);\n```\n\nWith `.then()`\n\n```js title=\"https.js\"\nconst { https } = require(\"simply-https\");\n\nhttps(\"postman-echo.com/get\")\n  .then((data) =\u003e data.json())\n  .then((res) =\u003e console.log(res));\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ePOST Request\u003c/summary\u003e\n\n```js title=\"https.js\"\nconst { https } = require(\"simply-https\");\n\nhttps(\"https://httpbin.org/post\", {\n  method: \"POST\",\n})\n  .then((data) =\u003e data.json())\n  .then((res) =\u003e console.log(res));\n```\n\nWith post body\n\n```js title=\"https.js\"\nconst { https } = require(\"simply-https\");\n\nhttps(\"https://httpbin.org/post\", {\n  method: \"POST\",\n  body: { message: \"hello world\" },\n})\n  .then((data) =\u003e data.json())\n  .then((res) =\u003e console.log(res));\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eTransition from node-fetch\u003c/summary\u003e\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003cth\u003e\nFrom fetch\n\u003c/th\u003e\n\u003cth\u003e\nTo simply-https\n\u003c/th\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\n\u003ctd\u003e\n\n```js\nconst { fetch } = require(\"node-fetch\");\n\nfetch(\"https://httpbin.org/post\", {\n  method: \"POST\",\n})\n  .then((data) =\u003e data.json())\n  .then((res) =\u003e console.log(res));\n```\n\n\u003c/td\u003e\n\n\u003ctd\u003e\n\n```js\nconst { https } = require(\"simply-https\");\n\nhttps(\"https://httpbin.org/post\", {\n  method: \"POST\",\n  body: { message: \"hello world\" },\n})\n  .then((data) =\u003e data.json())\n  .then((res) =\u003e console.log(res));\n```\n\n\u003c/td\u003e\n\n\u003c/tr\u003e\n\u003c/table\u003e\n\n```diff\n- fetch(\"https://httpbin.org/post\", {\n+ https(\"https://httpbin.org/post\", {\n```\n\nIts that simple.\nNo bloat, no sloppy anymore.\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRahuletto%2Fsimply-https","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRahuletto%2Fsimply-https","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRahuletto%2Fsimply-https/lists"}