{"id":16641826,"url":"https://github.com/samthor/syncingabout","last_synced_at":"2025-07-06T22:04:54.445Z","repository":{"id":66115194,"uuid":"384836692","full_name":"samthor/syncingabout","owner":"samthor","description":null,"archived":false,"fork":false,"pushed_at":"2021-08-28T05:05:31.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-12T05:29:46.939Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samthor.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":"2021-07-11T01:19:45.000Z","updated_at":"2021-08-28T05:05:33.000Z","dependencies_parsed_at":"2023-02-20T19:31:00.371Z","dependency_job_id":null,"html_url":"https://github.com/samthor/syncingabout","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/samthor/syncingabout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fsyncingabout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fsyncingabout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fsyncingabout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fsyncingabout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samthor","download_url":"https://codeload.github.com/samthor/syncingabout/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fsyncingabout/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261695085,"owners_count":23195684,"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":[],"created_at":"2024-10-12T07:48:00.245Z","updated_at":"2025-07-06T22:04:54.424Z","avatar_url":"https://github.com/samthor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Converts async methods to sync using `worker_threads`.\nLibrary related to [this blog post](https://whistlr.info/2021/block-nodejs-main-thread/).\nDoes not require compilation steps to work, can run anywhere in Node.js, has zero dependencies.\n\nThis'll allow you to call async methods _as if_ they were sync, but you have to move the async methods into their own file (and they'll run inside a `Worker`).\n\n# Usage\n\nCurrently ESM for now, but could be made CJS.\n\nHere's a demo which artificially loads a file using the async API of the built-in FS library, but makes those calls sync to the main thread.\n\nIn your main file:\n\n```js\n// main.js\nimport build from 'syncingabout';\n\nconst method = build('./method.js');  // relative to cwd, not this file\nconst result = method('foo.json');\n\nconsole.info('did something sync!', result);\n```\n\nIn your helper file (called \"method.js\" here), do this:\n\n```js\n// method.js\nimport {promises as fsPromises} from 'fs';\n\nexport default async function(filename) {\n  // do something async just for fun\n  await new Promise((r) =\u003e setTimeout(r, 1000));\n  const data = await fs.readFile(filename);\n  return data;\n};\n```\n\nGreat! 🥳","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fsyncingabout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamthor%2Fsyncingabout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fsyncingabout/lists"}