{"id":30048293,"url":"https://github.com/segmentio/protocol","last_synced_at":"2025-08-07T10:08:56.675Z","repository":{"id":11376362,"uuid":"13814839","full_name":"segmentio/protocol","owner":"segmentio","description":"Testing component used to fake different protocols from the browser","archived":false,"fork":false,"pushed_at":"2023-06-06T20:32:53.000Z","size":36,"stargazers_count":6,"open_issues_count":1,"forks_count":3,"subscribers_count":37,"default_branch":"master","last_synced_at":"2025-07-30T19:20:26.056Z","etag":null,"topics":["paused"],"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/segmentio.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","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":"2013-10-23T21:06:15.000Z","updated_at":"2023-08-22T17:01:06.000Z","dependencies_parsed_at":"2024-06-18T20:04:51.112Z","dependency_job_id":null,"html_url":"https://github.com/segmentio/protocol","commit_stats":{"total_commits":7,"total_committers":3,"mean_commits":"2.3333333333333335","dds":0.4285714285714286,"last_synced_commit":"95832eaffade2b6ec5c44182be8a8987d6a827d6"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/segmentio/protocol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segmentio%2Fprotocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segmentio%2Fprotocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segmentio%2Fprotocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segmentio%2Fprotocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/segmentio","download_url":"https://codeload.github.com/segmentio/protocol/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segmentio%2Fprotocol/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269238030,"owners_count":24383463,"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-07T02:00:09.698Z","response_time":73,"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":["paused"],"created_at":"2025-08-07T10:08:51.011Z","updated_at":"2025-08-07T10:08:56.643Z","avatar_url":"https://github.com/segmentio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protocol\n\n\u003e **Note**  \n\u003e Segment has paused maintenance on this project, but may return it to an active status in the future. Issues and pull requests from external contributors are not being considered, although internal contributions may appear from time to time. The project remains available under its open source license for anyone to use.\n\n[![CircleCI](https://circleci.com/gh/segmentio/protocol.svg?style=shield\u0026circle-token=bd6919f47872352a28fc52fbb399c8669775df41)](https://circleci.com/gh/segmentio/protocol)\n[![Codecov](https://img.shields.io/codecov/c/github/segmentio/protocol/master.svg?maxAge=2592000)](https://codecov.io/gh/segmentio/protocol)\n\nTesting component used to fake protocols from the browser. Overrides `window.location.protocol` properties with fake ones using `Object.defineProperty`, so it won't work on IE8. Probably a good thing to only use in testing.\n\n## Installation\n\n```js\n$ npm install @segment/protocol\n```\n\n## API\n\n### #protocol()\n\nReturns the current protocol that the document is using\n\n```js\nprotocol(); // 'http:'\n```\n\n### #protocol(protocol)\n\nWhen supplied with an argument, sets a custom protocol for the document.\n\n```js\nprotocol('chrome-extension:');\nprotocol(); // 'chrome-extension:'\n```\n\n### #http()\n\nSets the protocol to be `http`\n\n```js\nprotocol();  // 'file:'\nprotocol.http();  // 'http:'\n```\n\n### #https()\n\nSets the protocol to be `https:`\n\n```js\nprotocol();  // 'file:'\nprotocol.https();  // 'https:'\n```\n\n### #reset()\n\nResets the protocol to be whatever it was at page load.\n\n```js\nprotocol('x:');\nprotocol.reset();\nprotocol(); // 'http:'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegmentio%2Fprotocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsegmentio%2Fprotocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegmentio%2Fprotocol/lists"}