{"id":19274015,"url":"https://github.com/sbstjn/latenz","last_synced_at":"2025-08-31T16:38:06.930Z","repository":{"id":57289772,"uuid":"61611963","full_name":"sbstjn/latenz","owner":"sbstjn","description":"JavaScript HTTP latency analyzer","archived":false,"fork":false,"pushed_at":"2016-06-23T23:52:36.000Z","size":85,"stargazers_count":20,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-17T13:10:17.724Z","etag":null,"topics":["benchmark","javascript","latency","measure","network","nodejs"],"latest_commit_sha":null,"homepage":null,"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/sbstjn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-21T07:24:12.000Z","updated_at":"2022-08-23T09:20:19.000Z","dependencies_parsed_at":"2022-08-24T22:11:54.177Z","dependency_job_id":null,"html_url":"https://github.com/sbstjn/latenz","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/sbstjn%2Flatenz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbstjn%2Flatenz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbstjn%2Flatenz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbstjn%2Flatenz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbstjn","download_url":"https://codeload.github.com/sbstjn/latenz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250145311,"owners_count":21382392,"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":["benchmark","javascript","latency","measure","network","nodejs"],"created_at":"2024-11-09T20:44:49.196Z","updated_at":"2025-04-21T22:33:22.512Z","avatar_url":"https://github.com/sbstjn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# latenz\n\n[![Travis](https://img.shields.io/travis/sbstjn/latenz.svg?maxAge=600)](https://travis-ci.org/sbstjn/latenz) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://github.com/sbstjn/latenz/commits/master) [![npm](https://img.shields.io/npm/dt/latenz.svg?maxAge=600)](https://www.npmjs.com/package/latenz) [![npm](https://img.shields.io/npm/v/latenz.svg?maxAge=600)](https://www.npmjs.com/package/latenz)\n\nA JavaScript latency analyzer like [updown.io](https://updown.io) or [ping.apex.sh](https://ping.apex.sh). Get information about DNS lookup, connection time to your HTTP(S) server and how long it takes to receive the response.\n\n```bash\n$ \u003e npm install latenz -g\n$ \u003e latenz sbstjn.com\n\n             host: sbstjn.com\n\n      Name Lookup: 10ms     \n       Connection: 3ms        (13ms)\n         Response: 63ms       (76ms)\n         Received: 5ms        (81ms)\n\n            total: 81ms\n```\n\n![latenz](flow.png)\n\nIf you plan to use the result for further scripting, you might be a friend of the `raw mode`, which can be enabled by using `--raw` parameter:\n\n```bash\n$ \u003e latenz sbstjn.com --raw\n985 lookup:443 socket:3 response:534 end:5\n```\n\nFor using **HTTPS** instead of HTTP (default), just pass the `--secure` parameter to latenz:\n\n```bash\n$ \u003e latenz sbstjn.com --raw --secure\n985 lookup:443 socket:3 response:534 end:5\n```\n\n### JavaScript Usage\nIf you need the result as a JSON inside JavaScript:\n\n```javascript\nconst Latenz = require('latenz');\nconst l = new Latenz();\n\nl.measure('sbstjn.com').then(result =\u003e {\n  console.log(result);\n\n  /*\n    [\n      { key: 'resolve', time: 139 },\n      { key: 'socket', time: 2 },\n      { key: 'response', time: 286 },\n      { key: 'firstdata', time: 1 },\n      { key: 'end', time: 2 }\n    ]\n  */\n}).catch((e) =\u003e {\n  throw e;\n});\n```\n\nYou can pass an **options object** to `measure` in order to enable a secure connection, change the used port or set the result mode:\n\n```javascript\nl.measure('sbstjn.com',\n  {\n    secure: true,\n    port: 8443,\n    mode: 'pretty'\n  }\n);\n```\n\n### ToDo\n * Error handling\n * Support redirects\n * Check numbers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbstjn%2Flatenz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbstjn%2Flatenz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbstjn%2Flatenz/lists"}