{"id":18609724,"url":"https://github.com/unlight/deasynchronize","last_synced_at":"2025-06-16T03:35:38.327Z","repository":{"id":138160119,"uuid":"239143702","full_name":"unlight/deasynchronize","owner":"unlight","description":"Run asynchronous or synchronous function in subprocess and return result synchronously","archived":false,"fork":false,"pushed_at":"2020-08-27T15:48:21.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-25T13:02:14.902Z","etag":null,"topics":["deasync","deasynchronize","subprocess"],"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/unlight.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.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":"2020-02-08T14:16:30.000Z","updated_at":"2020-08-27T15:48:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d46b4df-eff9-430b-9164-81f0f4c14912","html_url":"https://github.com/unlight/deasynchronize","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fdeasynchronize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fdeasynchronize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fdeasynchronize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fdeasynchronize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unlight","download_url":"https://codeload.github.com/unlight/deasynchronize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239400596,"owners_count":19632049,"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":["deasync","deasynchronize","subprocess"],"created_at":"2024-11-07T03:07:04.047Z","updated_at":"2025-02-18T03:15:12.458Z","avatar_url":"https://github.com/unlight.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deasynchronize\n\nRun asynchronous or synchronous function in subprocess and return result synchronously\n\n## Install\n\n```sh\nnpm i -S deasynchronize\n```\n\n## Usage\n\n```ts\nconst result = deasynchronize(1, 2, async (a, b) =\u003e {\n    // This is not a closure!\n    await new Promise(resolve =\u003e setTimeout(resolve, 0));\n    return `async result ${a + b}`;\n});\nconsole.log(result); // =\u003e 'async result 3'\n```\n\n## API\n\n```ts\ndeasynchronize(...args: any[], f: (...args: any[]) =\u003e any): string\n```\n\nFunction `f` is not a closure and do not has access to parent scope, it runs in subprocess.\nYou should require all dependencies inside this function. Result will be converted to string.\n\n```ts\nconst result = deasynchronize(async () =\u003e {\n    // This is not a closure!\n    const os = require('os');\n    return os.platform();\n});\n```\n\nIt is possible to pass parameters to function:\n\n```ts\nconst result = deasynchronize('meow', async sound =\u003e {\n    // This is not a closure!\n    return `Incoming sound is ${sound}`;\n});\nconsole.log(result); // =\u003e 'Incoming sound is meow'\n```\n\nRemember, this function is not a closure!\n\n## Similar Packages\n\n-   https://github.com/ForbesLindesay/sync-rpc\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Fdeasynchronize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funlight%2Fdeasynchronize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Fdeasynchronize/lists"}