{"id":32117211,"url":"https://github.com/lawsoncheng/poke","last_synced_at":"2026-02-19T08:01:18.040Z","repository":{"id":39759079,"uuid":"361659954","full_name":"LawsonCheng/poke","owner":"LawsonCheng","description":"👈🏽 A Super handy HTTP Client written in TypeScript.","archived":false,"fork":false,"pushed_at":"2022-05-26T07:18:47.000Z","size":205,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-18T04:21:54.367Z","etag":null,"topics":["http-request","javascript","library","module","node","nodejs","npm","npm-package","poke","request","typescript"],"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/LawsonCheng.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-04-26T07:38:44.000Z","updated_at":"2022-04-20T08:13:47.000Z","dependencies_parsed_at":"2022-09-07T07:01:43.253Z","dependency_job_id":null,"html_url":"https://github.com/LawsonCheng/poke","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/LawsonCheng/poke","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LawsonCheng%2Fpoke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LawsonCheng%2Fpoke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LawsonCheng%2Fpoke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LawsonCheng%2Fpoke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LawsonCheng","download_url":"https://codeload.github.com/LawsonCheng/poke/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LawsonCheng%2Fpoke/sbom","scorecard":{"id":82534,"data":{"date":"2025-08-11","repo":{"name":"github.com/LawsonCheng/poke","commit":"6ee23ef013d79fbfdcd9f47abc711edd3a240be8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 1/18 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/eslint.yml:1","Warn: no topLevel permission defined: .github/workflows/jest.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/LawsonCheng/poke/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/eslint.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/LawsonCheng/poke/eslint.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/jest.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/LawsonCheng/poke/jest.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/build.yml:15","Warn: npmCommand not pinned by hash: .github/workflows/eslint.yml:15","Warn: npmCommand not pinned by hash: .github/workflows/jest.yml:15","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T06:12:53.781Z","repository_id":39759079,"created_at":"2025-08-15T06:12:53.781Z","updated_at":"2025-08-15T06:12:53.781Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29608152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["http-request","javascript","library","module","node","nodejs","npm","npm-package","poke","request","typescript"],"created_at":"2025-10-20T16:29:54.507Z","updated_at":"2026-02-19T08:01:18.033Z","avatar_url":"https://github.com/LawsonCheng.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Poke\nA lightweight and handy JS HTTP Client.\n\n[![npm package](https://nodei.co/npm/js.poke.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/js.poke/)\n\n[![Build-status](https://github.com/LawsonCheng/poke/actions/workflows/build.yml/badge.svg)](https://github.com/LawsonCheng/poke/actions/workflows/build.yml/badge.svg)\n[![Tests](https://github.com/LawsonCheng/poke/actions/workflows/jest.yml/badge.svg)](https://github.com/LawsonCheng/poke/actions/workflows/jest.yml/badge.svg)\n[![esLint](https://github.com/LawsonCheng/poke/actions/workflows/eslint.yml/badge.svg)](https://github.com/LawsonCheng/poke/actions/workflows/eslint.yml/badge.svg)\n[![Dependency Status](https://img.shields.io/david/LawsonCheng/poke.svg?style=flat-square)](https://david-dm.org/LawsonCheng/poke)\n[![Known Vulnerabilities](https://snyk.io/test/npm/js.poke/badge.svg?style=flat-square)](https://snyk.io/test/npm/js.poke)\n\n## Why use Poke?\n\n- 😌 \u0026nbsp;\u0026nbsp;Very easy to use\n- 👨🏻‍💻 \u0026nbsp;\u0026nbsp;Written in TypeScript\n- 🚀 \u0026nbsp;\u0026nbsp;Lightweight\n- ⼮ \u0026nbsp;\u0026nbsp;Stream support\n- 💾 \u0026nbsp;\u0026nbsp;Easy to download file\n## Installation\n```sh\nnpm i js.poke --save\n```\nor\n```sh\nyarn add js.poke\n```\n\n## Easy to use!\nPoke allows you to make http request in the simplest way. See the following example:\n\n```js\nconst poke = require('js.poke')\n\n// Using promise\npoke('https://foo.api.com/candys')\n.promise()\n.then(result =\u003e {\n    // response body here\n    console.log('\u003e body(string): ', result.body)\n    // get result in json format\n    return result.json()\n})\n.then(json =\u003e {\n    // here is the json object\n    console.log('\u003e json: ', json)\n})\n.catch(err =\u003e {\n    console.log('\u003e Error: ', err)\n})\n```\n\n## Usage\n### How to use poke\n\nPoke accepts `hostname`, `pokeOptions` and the callback function as the inputs.\nthen it returns some methods for you to apply in different scenarios.\nOmit the callback function if you would like to handle the result with `Promise`.\n\n\n### promise\n```js\nconst poke = require('js.poke')\n\n// Using promise\npoke(hostname , pokeOptions)\n.promise()\n.then(result =\u003e { \n    // do your handling here\n    ... \n})\n.catch(error =\u003e {\n    // handle error\n    ...\n})\n```\n\n\n### callback\n```js\nconst poke = require('js.poke')\n// Using callback\npoke(hostname , pokeOptions, result =\u003e {\n    // status code\n    console.log(result.statusCode)\n    // body\n    console.log(result.body)\n    // in json format\n    result.json(json =\u003e {\n        console.log(json)\n    })\n    // error\n    console.log(result.error)\n})\n```\n\n\n### Form Data\n```js\npoke(\n    'https://httpbin.org/post',\n    {\n        method : 'POST',\n        // Specify your form data with `boby`\n        body : JSON.stringify({\n            name : 'kfhk!sdkm!'\n        })\n    }\n)\n// ...\n```\n\n### Listening to events by using `on`\n```js\nconst poke = require('js.poke')\n// Using callback\npoke(hostname , pokeOptions)\n// listen to response retrived\n.on('response', result =\u003e {\n    console.log(result)\n})\n// on chunk is recieved\n.on('data', (chunk) =\u003e {\n    // handle your data here\n    console.log(chunk)\n})\n// on request eneded\n.on('end', () =\u003e {\n    console.log('Request is finished')\n})\n// listening to error\n.on('error', (result) =\u003e {\n    // handle error\n    console.log(result.error)\n})\n```\n\n### Stream\n\n```js\nconst fs = require('fs')\nconst poke = require('js.poke')\n\n// get image\npoke('https://via.placeholder.com/100x100')\n// write data as an image file\n.pipe(fs.createWriteStream('image.png'))\n```\n\nEven we can using Poke as a proxy!\n```js\nconst poke = require('js.poke')\n\nconst serv = http.createServer((req, res) =\u003e {\n    if (req.url === '/placeholder') {\n        // get image or whatever you want\n        poke('https://via.placeholder.com/100x100')\n        // pipe response to res\n        .pipe(res)\n    } else {\n        res.end('Bye!')\n    }\n})\nserv.listen(4321)\n```\n\n\n### The Poke Options\nThe `pokeOptions` allows you to customize your request.\n\n```js\n// The poke option\nconst options = {\n    // POST, PUT, DELETE\n    method : \"GET\", \n    path : \"/\", \n    port : 3001,\n    // will set automatically, you may override the auto-detect value by specify this boolean\n    gzip : true, \n    // in millisecond, if timeout is set and theer is no response return before timeout, request will abort\n    timeout : 1000\n    // username and password for Basic Auth\n    username : 'foo_user',\n    password : 'foo_secret'\n    // customize your header here\n    headers : {\n        \"content-type\" : \"application/json\"\n    },\n    // will parse your query object to query string automatically\n    query : { page : 3 }\n    // form body\n    body : JSON.stringify({\n        first_name : \"Poke\",\n        last_name : \"You\"\n    })\n}\n\npoke('https://foo.api.com', options)\n```\n\n### PokeResult\nThe `PokeResult` is returned with one of the following types `PokeSuccess` and `PokeError`.\n#### PokeSuccess\n`PokeSuccess` contains the `req`, `body`, `statusCode`, `json()` and `headers`. call `json()` returns a promise and parse the body into json object.\n#### PokeError\nif the request is failed, `PokeError` contains `error`(type: `Error`) will be returned.\n\n\n```js\npoke('https://foo.api.com', options)\n.promise()\n.then(result =\u003e {\n    // status code\n    console.log(result.statusCode)\n    // body:string\n    console.log(result.body)\n    // headers\n    console.log(result.headers)\n    // parse json\n    return result.json()\n})\n.then(json =\u003e {\n    // handle with parsed json\n    console.log(json)\n})\n.catch(result =\u003e {\n    // handler error\n    console.log(result.error);\n})\n```\n\n### Authentication\n#### Basic-auth\nSimply put your basic-auth's username and password in PokeOption.\n\n```js\nconst options = {\n    method : \"GET\", \n    // username and password for Basic Auth\n    username : 'foo_user',\n    password : 'foo_secret',\n}\n\npoke('https://foo.api.com', options)\n.promise()\n.then(result =\u003e result.json())\n.then(json =\u003e console.log(result))\n.catch(result =\u003e console.log(result.error))\n```\n\n#### Bearer auth\nPut the bearer token into header for doing bearer authentication.\n\n\n```js\nconst options = {\n    method : \"GET\", \n    headers : {\n        'authorization' : `Bearer ${your_bearer_token}`\n    }\n}\n\npoke('https://foo.api.com', options)\n.promise()\n.then(result =\u003e result.json())\n.then(json =\u003e console.log(result))\n.catch(result =\u003e console.log(result.error))\n```\n\n### Customize header\nPut custom headers attributes into `headers` of PokeOption.\n\n```js\npoke('https://foo.api.com', {\n    ...\n    headers : {\n        // put your headers here....\n        'content-type' : 'application/json',\n    }\n})\n```\n\n## Become a contirbutor!\nMillion thanks to whom contributes to this project!❤️\n\u003cbr/\u003e\n\u003ca href = \"https://github.com/LawsonCheng/poke/contributors\"\u003e\n  \u003cimg src = \"https://contrib.rocks/image?repo=LawsonCheng/poke\"/\u003e\n\u003c/a\u003e\n\u003c/div\u003e\n\nPull requests are welcome! Please see [CONTRIBUTING.md](https://github.com/LawsonCheng/poke/blob/main/CONTRIBUTING.md)\n\n## What's Next?\n- 🔌 \u0026nbsp;\u0026nbsp;WebSocket (Upcoming)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flawsoncheng%2Fpoke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flawsoncheng%2Fpoke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flawsoncheng%2Fpoke/lists"}