{"id":18901131,"url":"https://github.com/regular/progress-pipeline","last_synced_at":"2025-09-03T08:17:47.307Z","repository":{"id":31939631,"uuid":"35509247","full_name":"regular/progress-pipeline","owner":"regular","description":"like async.series but with a readable-stream interface for progress events","archived":false,"fork":false,"pushed_at":"2015-05-20T16:17:40.000Z","size":156,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T15:22:14.003Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/regular.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-12T19:49:23.000Z","updated_at":"2015-05-13T23:15:37.000Z","dependencies_parsed_at":"2022-09-16T17:21:20.179Z","dependency_job_id":null,"html_url":"https://github.com/regular/progress-pipeline","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regular%2Fprogress-pipeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regular%2Fprogress-pipeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regular%2Fprogress-pipeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regular%2Fprogress-pipeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/regular","download_url":"https://codeload.github.com/regular/progress-pipeline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239886068,"owners_count":19713421,"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-11-08T08:55:18.667Z","updated_at":"2025-02-20T17:41:43.340Z","avatar_url":"https://github.com/regular.png","language":"JavaScript","readme":"progress-pipeline\n===\nLike async.series, but with a readable-stream interface for getting progress events.\n\nInstallation\n---\n```\nnpm install progress-pipeline\n```\n\nUsage\n---\n``` javascript\nvar series = require('progress-pipeline');\n\nvar jobs =[\n    function cloning(cb) {\n        gitClone(user + '/' + repo, function(err) {\n            cb(err, 'done cloning');\n        });\n    },\n    function installing(cb) {\n        shell('cd '+ repo +' \u0026\u0026 npm install', function(err) {\n            cb(err, 'done installing');\n        });\n    }\n];\n\nseries(jobs).on('data', function(data) {\n    console.log(data.jobFinished ? data.result : data.jobIndex + '/' + data.totalJobs + data.job.name + ' ...');\n});\n```\n\noutput:\n```\n0/2 cloning ...\ndone cloning\n1/2 installing ...\ndone installing\n```\n\nJob Functions\n---\nJobs are regular, node-style async functions, e.g. they are being called with an [error-first callback](http://fredkschott.com/post/2014/03/understanding-error-first-callbacks-in-node-js/) and are required to call that callback with an error and an optional result argument.\n\n_Note_ You can add properties to the job functions before putting them into the pipeline and you will have access to these prperties in your on('data') event handler. See [demo.js](./demo.js) for an example.\n\nEvents\n---\nYou get two `data` events per job\n\n* one when the job has started\n```\n{\n    jobFinished: false,\n    job: \u003cthe job-function you provided\u003e\n    jobIndex: \u003czero-based index of this job\u003e\n    totalJobs: \u003ctotal number of jobs in the pipeline\u003e\n}\n```\n\n* and one when the job has finished\n```\n{\n    jobFinished: true,\n    job: \u003cthe job-function you provided\u003e\n    jobIndex: \u003czero-based index of this job\u003e\n    totalJobs: \u003ctotal number of jobs in the pipeline\u003e\n    result: \u003cthe job's result\u003e\n}\n```\n\nIn case a job fails, the stream emits an `error` event.\nThe emitted error has the following additional properties:\n\n```\n{\n    job: \u003cthe job-function you provided\u003e\n    jobIndex: \u003czero-based index of this job\u003e\n    totalJobs: \u003ctotal number of jobs in the pipeline\u003e\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregular%2Fprogress-pipeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fregular%2Fprogress-pipeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregular%2Fprogress-pipeline/lists"}