{"id":23053629,"url":"https://github.com/component/network","last_synced_at":"2025-08-15T04:30:51.440Z","repository":{"id":65994265,"uuid":"9656633","full_name":"component/network","owner":"component","description":"Measure network latency to make dynamic adjustments to content","archived":false,"fork":false,"pushed_at":"2013-08-21T17:33:06.000Z","size":53,"stargazers_count":40,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-03T07:05:42.544Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/component.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-24T20:07:26.000Z","updated_at":"2024-08-23T15:17:03.000Z","dependencies_parsed_at":"2023-02-19T21:00:54.046Z","dependency_job_id":null,"html_url":"https://github.com/component/network","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/component/network","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Fnetwork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Fnetwork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Fnetwork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Fnetwork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/component","download_url":"https://codeload.github.com/component/network/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Fnetwork/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270523874,"owners_count":24600186,"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-08-15T02:00:12.559Z","response_time":110,"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-16T00:18:55.895Z","updated_at":"2025-08-15T04:30:51.204Z","avatar_url":"https://github.com/component.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# network\n\n  Measure network latency to make dynamic adjustments to content.\n\n## Installation\n\n    $ component install component/network\n\n## API\n\n### network.measure(options)\n\n  Start a measurement with the given byte `.size` specified. A function\n  is returned which should be called _after_ the data transfer is complete. This\n  function returns the measurements:\n\n```js\n{\n  duration: 5749,\n  size: 994868,\n  bps: 1408912.01,\n  kbps: 1375.89,\n  mbps: 1.34\n}\n```\n\n## Example\n\n  The following example measures image s3 download latency, and may be used\n  to detect a poor connection and respond with smaller images.\n\n```js\nvar network = require('network');\nvar latency = network.measure({ size: 994868 });\n\nvar url = 'http://i.cloudup.com/iSVZF2meyeA.jpg?' + Date.now();\nvar img = new Image;\n\nimg.onload = function(){\n  var res = latency();\n  console.log('%s mbps', res.mbps.toFixed(2));\n};\n\nimg.src = url;\n```\n\n## License\n\n  MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomponent%2Fnetwork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomponent%2Fnetwork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomponent%2Fnetwork/lists"}