{"id":15092829,"url":"https://github.com/rayhanadev/lightfetch","last_synced_at":"2025-08-04T18:39:37.707Z","repository":{"id":62422250,"uuid":"377300096","full_name":"rayhanadev/lightfetch","owner":"rayhanadev","description":"Zero dependencies, lightweight, and asynchronous https requests package.","archived":false,"fork":false,"pushed_at":"2021-10-24T15:39:07.000Z","size":1775,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-07T11:05:06.192Z","etag":null,"topics":["deno","https","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/rayhanadev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-15T21:42:07.000Z","updated_at":"2022-12-08T15:46:18.000Z","dependencies_parsed_at":"2022-11-01T17:33:07.527Z","dependency_job_id":null,"html_url":"https://github.com/rayhanadev/lightfetch","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayhanadev%2Flightfetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayhanadev%2Flightfetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayhanadev%2Flightfetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayhanadev%2Flightfetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rayhanadev","download_url":"https://codeload.github.com/rayhanadev/lightfetch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223502361,"owners_count":17155938,"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":["deno","https","nodejs"],"created_at":"2024-09-25T11:01:46.362Z","updated_at":"2024-11-07T11:05:12.496Z","avatar_url":"https://github.com/rayhanadev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e This project is a **Work in Progress** and currently in development. The API is\n\u003e subject to change without warning.\n\n\u003cdiv align=\"center\"\u003e\n\t\u003ca href=\"https://github.com/RayhanADev/lightfetch\"\u003e\n\t\t\u003cimg src=\"https://github.com/RayhanADev/lightfetch/blob/master/images/lightfetch.png?raw=true\" alt=\"Lightfetch Banner\" width=\"900\" /\u003e\n\t\u003c/a\u003e\n\t\u003cbr /\u003e\n\t\u003ca href=\"https://github.com/RayhanADev/lightfetch/graphs/contributors\"\u003e\u003cimg src=\"https://img.shields.io/github/contributors/RayhanADev/lightfetch.svg?style=for-the-badge\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/RayhanADev/lightfetch.svg/graphs/contributors\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/RayhanADev/lightfetch.svg?style=for-the-badge\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/RayhanADev/lightfetch/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/RayhanADev/lightfetch.svg?style=for-the-badge\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/RayhanADev/lightfetch/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/RayhanADev/lightfetch.svg?style=for-the-badge\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/RayhanADev/lightfetch/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/RayhanADev/lightfetch.svg?style=for-the-badge\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/lightfetch-node\"\u003e\u003cimg src=\"https://img.shields.io/npm/dw/lightfetch-node?style=for-the-badge\"\u003e\u003c/a\u003e\n\t\u003cbr /\u003e\n\t\u003cp\u003e\n\t\t\u003cem\u003eA small fetching package for super simple usages.\u003c/em\u003e\n\t\t\u003cbr /\u003e\n\t\tBuilt using \u003cstrong\u003ezero dependencies\u003c/strong\u003e to be \u003cstrong\u003elightweight\u003c/strong\u003e\n\t\tand \u003cstrong\u003easynchronous\u003c/strong\u003e.\n\t\t\u003cbr /\u003e\n\t\tLightfetch gives you the best of size, speed, and usability.\n\t\u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n## Install\n\n```sh\nnpm install lightfetch-node\n```\n\n## Usage\n\n### Main API\n\n```js\nawait lightfetch(url, [options]);\n```\n\nwhich returns a [`\u003cResponse\u003e`](#response)\n\n### Options\n\n-   method: HTTP Request Method\n-   headers: HTTP Headers to use in Request\n-   body: Data to use in the Request\\*\n\n\\* _Data that can be used in body includes an Object, a string that's\nin x-www-form-urlencoded format, or plain text. Lightfetch will figure\nout what you pass in automagically and set the appropriate headers._\n\n### Response\n\nThe items in a response include:\n\n-   `\u003cResponse\u003e.status`: The status code of a response\n-   `\u003cResponse\u003e.headers`: The headers in a response\n-   `\u003cResponse\u003e.cookies`: The cookies in a response (uses an API similar to [this](https://github.com/nfriedly/set-cookie-parser) internally)\n-   `\u003cResponse\u003e.json`: A function to parse the content of a response to JSON\n-   `\u003cResponse\u003e.text`: A function to parse the content of a response to text\n\n\u003e If the above does not statisfy your needs, you can also use `\u003cResponse\u003e.response`\n\u003e to access the unmodified, raw response NodeJS outputs.\n\n## Example\n\n```js\n// using CommonJS\nconst { lightfetch } = require('lightfetch-node');\n\n// using ESM\nimport { lightfetch } from 'lightfetch-node';\n\nasync function fetch(url) {\n  const res = await lightfetch(url, {\n    method: 'GET',\n    headers: {\n      'X-Requested-With': 'RayhanADev',\n    },\n  });\n  console.log('Status:', res.status);\n  console.log('Response:', res.toJSON());\n  console.log('Cookies:', res.cookies);\n}\n\nfetch('https://postman-echo.com/get?foo=bar');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayhanadev%2Flightfetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frayhanadev%2Flightfetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayhanadev%2Flightfetch/lists"}