{"id":20390469,"url":"https://github.com/checkly/tcp-ping","last_synced_at":"2026-06-07T00:31:40.322Z","repository":{"id":80583577,"uuid":"477792544","full_name":"checkly/tcp-ping","owner":"checkly","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-18T19:23:23.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-01T08:44:03.083Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/checkly.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":"2022-04-04T16:54:33.000Z","updated_at":"2022-11-15T21:12:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"d100a84d-e3ff-45c1-9c72-9b744f79dce5","html_url":"https://github.com/checkly/tcp-ping","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/checkly/tcp-ping","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Ftcp-ping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Ftcp-ping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Ftcp-ping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Ftcp-ping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/checkly","download_url":"https://codeload.github.com/checkly/tcp-ping/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Ftcp-ping/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34005030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"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-11-15T03:25:07.916Z","updated_at":"2026-06-07T00:31:40.300Z","avatar_url":"https://github.com/checkly.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TCP ping\n\n- Typescript first\n- zero dependencies\n- has some tests\n- modern codebase\n\n## Usage\n\n```ts\nimport { TcpPing, TcpPingOptions } from '@checkly/clients/tcp-ping'\n\nconst options: TcpPingOptions = { host: 'localhost', port: 8080 }\nconst tcpPingResult = await new TcpPing().ping(options)\n\nconsole.log(tcpPingResult)\n\n/** prints\n{\n  \"state\": \"SUCCESS\",\n  \"timings\": {\n    \"start\": 1668546586515,\n    \"lookup\": 1668546586572,\n    \"connect\": 1668546586599,\n    \"error\": 0,\n    \"end\": 1668546586600,\n    \"phases\":{\n      \"dns\": 57.748715,\n      \"connect\": 27.112156000000006,\n      \"total\": 84.916527\n  }\n**/\n```\n\n# Adding payloads\n\nYou can write to the socket by adding a payload as a `Buffer`. This will also record the `data` time mark and the \n`firstByte` phase, as well as a `reponse` in the result. This way you can ping Redis for instance:\n\n```ts\nimport { TcpPing, TcpPingOptions } from '@checkly/clients/tcp-ping'\nconst options = { host: 'localhost', port: 6379, payload: new Buffer('*1\\r\\n$4\\r\\nPING\\r\\n', 'utf8') }\nconst tcpPingResult = await new TcpPing().ping(options)\n\nconsole.log(tcpPingResult)\n\n/** prints\n {\n      state: 'SUCCESS',\n      timings: {\n        start: 1668799114636,\n        lookup: 1668799114644,\n        connect: 1668799114647,\n        data: 1668799114647,\n        error: 0,\n        end: 1668799114647,\n        phases: {\n          dns: 7.833849,\n          connect: 3.4006320000000008,\n          firstByte: 3.571518,\n          total: 14.805999\n        }\n      },\n      response: \u003cBuffer 2b 50 4f 4e 47 0d 0a\u003e\n    }\n**/\n```\nConverting the `Buffer` to a `string` yields:\n\n```ts\nconsole.log(tcpPingResult.response.toString())\n// prints '+PONG\\r\\n'\n```\n\n## Inspiration\n\nhttps://github.com/zulhilmizainuddin/nodejs-traceroute\nhttps://github.com/apaszke/tcp-ping/blob/master/ping.js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckly%2Ftcp-ping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheckly%2Ftcp-ping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckly%2Ftcp-ping/lists"}