{"id":15879971,"url":"https://github.com/cssmagic/gulp-stream-to-promise","last_synced_at":"2025-03-17T12:31:03.291Z","repository":{"id":57259081,"uuid":"73269458","full_name":"cssmagic/gulp-stream-to-promise","owner":"cssmagic","description":"Convert gulp stream to promise.","archived":false,"fork":false,"pushed_at":"2016-11-09T11:02:46.000Z","size":2,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-06T20:03:46.933Z","etag":null,"topics":["gulp","gulp-stream","promise"],"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/cssmagic.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":"2016-11-09T09:30:35.000Z","updated_at":"2021-02-23T22:06:40.000Z","dependencies_parsed_at":"2022-08-28T21:41:52.466Z","dependency_job_id":null,"html_url":"https://github.com/cssmagic/gulp-stream-to-promise","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssmagic%2Fgulp-stream-to-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssmagic%2Fgulp-stream-to-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssmagic%2Fgulp-stream-to-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssmagic%2Fgulp-stream-to-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cssmagic","download_url":"https://codeload.github.com/cssmagic/gulp-stream-to-promise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221677979,"owners_count":16862335,"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":["gulp","gulp-stream","promise"],"created_at":"2024-10-06T03:06:52.313Z","updated_at":"2024-10-27T13:04:57.896Z","avatar_url":"https://github.com/cssmagic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-stream-to-promise\n\n\u003e Convert gulp stream to promise.\n\n## Introduction\n\nIn Gulp 4, all task functions need to be async, that means a task function needs to return a gulp stream, or a promise, etc.\n\nWith this feature, we can define multiple gulp streams as one gulp task. To do that, firstly we convert each gulp steam to promise, then combine them via `Promise.all()` to get one promise, finally return this all-in-one promise in the task function.\n\nThis package is to convert gulp streams to promises.\n\n## Usage\n\n0. Install:\n\n\t```sh\n\t$ npm install --save gulp-stream-to-promise\n\t```\n\n0. Require:\n\n\t```js\n\tconst gulpStreamToPromise = require('gulp-stream-to-promise')\n\t```\n\n0. Convert:\n\n\t```js\n\t// we have a gulp stream here:\n\tlet stream = gulp.src('path/to/src')\n\t\t.pipe(/* ... */)\n\t\t.pipe(gulp.dest('path/to/dest'))\n\t\n\t// convert it to a promise:\n\tlet promise = gulpStreamToPromise(stream)\n\t```\n\n## Example\n\n```js\nconst gulp = require('gulp')\t// gulp 4\nconst concat = require('gulp-concat')\nconst gulpStreamToPromise = require('gulp-stream-to-promise')\n\n// suppose we need to combine files according to this config:\nconst rules = {\n\t'foo.js': [\n\t\t'./node_modules/foo/src/a.js',\n\t\t'./node_modules/foo/src/b.js',\n\t],\n\t'bar.js': [\n\t\t'./src/c.js',\n\t\t'./src/d.js',\n\t],\n}\n\ngulp.task('js', () =\u003e {\n\t// array to contain each single combining operation:\n\tvar tasks = []\n\n\tObject.keys(rules).forEach((filename) =\u003e {\n\t\tlet src = rules[filename]\n\t\t\n\t\t// get a gulp stream for a combining operation:\n\t\tlet stream = gulp.src(src)\n\t\t\t.pipe(concat(filename))\n\t\t\t.pipe(gulp.dest('path/to/dest'))\n\n\t\t// convert this gulp stream to a promise:\n\t\tlet promise = gulpStreamToPromise(stream)\n\n\t\t// put into the array:\n\t\ttasks.push(promise)\n\t})\n\t\n\t// return the combined promise to complete the task function:\n\treturn Promise.all(tasks)\n})\n```\n\n***\n\n## License\n\n[MIT License](http://www.opensource.org/licenses/mit-license.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssmagic%2Fgulp-stream-to-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcssmagic%2Fgulp-stream-to-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssmagic%2Fgulp-stream-to-promise/lists"}