{"id":20114403,"url":"https://github.com/leecjson/node-combine-result","last_synced_at":"2025-08-04T06:39:45.572Z","repository":{"id":57203852,"uuid":"159180981","full_name":"leecjson/node-combine-result","owner":"leecjson","description":"Combine results","archived":false,"fork":false,"pushed_at":"2018-11-26T15:21:17.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-23T06:16:23.724Z","etag":null,"topics":[],"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/leecjson.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}},"created_at":"2018-11-26T14:18:51.000Z","updated_at":"2018-11-26T15:27:02.000Z","dependencies_parsed_at":"2022-09-17T15:14:55.337Z","dependency_job_id":null,"html_url":"https://github.com/leecjson/node-combine-result","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leecjson/node-combine-result","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leecjson%2Fnode-combine-result","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leecjson%2Fnode-combine-result/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leecjson%2Fnode-combine-result/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leecjson%2Fnode-combine-result/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leecjson","download_url":"https://codeload.github.com/leecjson/node-combine-result/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leecjson%2Fnode-combine-result/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268658614,"owners_count":24285726,"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-04T02:00:09.867Z","response_time":79,"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-11-13T18:29:37.909Z","updated_at":"2025-08-04T06:39:45.549Z","avatar_url":"https://github.com/leecjson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-combine-result\n\n# Usage\nCombine a few call to a single result which it's returned by first call.\n\nConsider you have a few requests to reads a same file that is very huge let's say it about 1GB and assume it's a fixed file; in that case, u don't want to read the file in each request, so let's combine those requests to read the file just once.\n```shell\nnpm install --save combine-result\n```\n```javascript\nconst readFile = path =\u003e {\n  return new Promise(resolve =\u003e {\n    setTimeout(() =\u003e resolve('huge content'), 1000); // 1Gb file, read it cost 1000ms\n  });\n};\n\nconst combine = requrie('combine-result')();\nconst readFileCombined = path =\u003e {\n  return combine(path, () =\u003e readFile(path));\n}\n\n// The following three will combine, read 'a.txt' and return it three times\nreadFileCombined('a.txt').then(val =\u003e console.log(val), err =\u003e console.log(err));\nreadFileCombined('a.txt').then(val =\u003e console.log(val), err =\u003e console.log(err));\nreadFileCombined('a.txt').then(val =\u003e console.log(val), err =\u003e console.log(err));\n\n// The following two are combined\nreadFileCombined('b.txt').then(val =\u003e console.log(val), err =\u003e console.log(err));\nreadFileCombined('b.txt').then(val =\u003e console.log(val), err =\u003e console.log(err));\n\nsetTimeout(() =\u003e {\n  // Reread 'a.txt' since lastest read 'a.txt' calls has returned.\n  readFileCombined('a.txt').then(val =\u003e console.log(val), err =\u003e console.log(err));\n\n  // The following three are combined\n  readFileCombined('c.txt').then(val =\u003e console.log(val), err =\u003e console.log(err));\n  readFileCombined('c.txt').then(val =\u003e console.log(val), err =\u003e console.log(err));\n  readFileCombined('c.txt').then(val =\u003e console.log(val), err =\u003e console.log(err));\n}, 1500);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleecjson%2Fnode-combine-result","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleecjson%2Fnode-combine-result","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleecjson%2Fnode-combine-result/lists"}