{"id":22889338,"url":"https://github.com/wong2/electron-fetch-via-main","last_synced_at":"2026-04-27T23:32:08.055Z","repository":{"id":203304292,"uuid":"709266430","full_name":"wong2/electron-fetch-via-main","owner":"wong2","description":"Simple cross origin requests in Electron","archived":false,"fork":false,"pushed_at":"2023-10-25T06:46:25.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-23T02:59:14.651Z","etag":null,"topics":["electron","fetch"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/electron-fetch-via-main","language":"TypeScript","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/wong2.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":"2023-10-24T11:22:18.000Z","updated_at":"2023-10-25T06:47:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"f724f13c-3b93-4729-97a0-a3676cfe8097","html_url":"https://github.com/wong2/electron-fetch-via-main","commit_stats":null,"previous_names":["wong2/electron-fetch-via-main"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wong2/electron-fetch-via-main","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wong2%2Felectron-fetch-via-main","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wong2%2Felectron-fetch-via-main/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wong2%2Felectron-fetch-via-main/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wong2%2Felectron-fetch-via-main/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wong2","download_url":"https://codeload.github.com/wong2/electron-fetch-via-main/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wong2%2Felectron-fetch-via-main/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32360110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"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":["electron","fetch"],"created_at":"2024-12-13T21:30:47.651Z","updated_at":"2026-04-27T23:32:08.038Z","avatar_url":"https://github.com/wong2.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# electron-fetch-via-main\n\n## Why\n\nThis module helps you bypass restrictions when making cross origin requests in renderer process, by delegate the requests to main process.\n\n## Install\n\n```\nnpm install electron-fetch-via-main\n```\n\n## Usage\n\n\u003e Note that this module only work with `contextIsolation: false`\n\nIn main process\n\n```\nimport { setupMainFetchlistener } from 'electron-fetch-via-main'\n\nsetupMainFetchlistener()\n```\n\nIn preload scripts, expose `fetchViaMain` to renderer\n\n```\nimport { fetchViaMain } from 'electron-fetch-via-main'\n\nwindow.fetchViaMain = fetchViaMain\n```\n\nIn renderer process, just replace `fetch` with `fetchViaMain`\n\n```\nconst resp = await window.fetchViaMain('https://...', {\n  method: 'POST',\n  body: { ... },\n})\n\n// read json\nawait resp.json()\n\n// streaming response\nfor await (const chunk of resp.body) {\n  ...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwong2%2Felectron-fetch-via-main","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwong2%2Felectron-fetch-via-main","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwong2%2Felectron-fetch-via-main/lists"}