# gulp-foreach

> Send each file in a stream down its own stream

Latest version **0.1.0** (published 2014-12-12) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install gulp-foreach
pnpm add gulp-foreach
yarn add gulp-foreach
bun add gulp-foreach
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-12-12 |
| First published | 2014-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Marius Gundersen |
| Maintainers | mariusgundersen |
| Keywords | gulpplugin, forEach, split, fork, divide, separate, map, gulp |

## Links

- npm: https://www.npmjs.com/package/gulp-foreach
- Repository: https://github.com/mariusGundersen/gulp-forEach
- Issues: https://github.com/mariusGundersen/gulp-forEach/issues
- npm.io page: https://npm.io/package/gulp-foreach

## Dependencies (2)

- [through2](https://npm.io/package/through2.md) ~0.6.3
- [gulp-util](https://npm.io/package/gulp-util.md) ~2.2.14

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2014-12-12
- 0.0.1 — 2014-05-24
- 0.0.0 — 2014-05-01

## README

# [gulp](http://gulpjs.com)-foreach

> Send each file in a stream down its own stream


## Install

```bash
$ npm install --save-dev gulp-foreach
```


## Usage

```js
var gulp = require('gulp');
var foreach = require('gulp-foreach');

gulp.task('default', function () {
  return gulp.src('src/*.js')
    .pipe(foreach(function(stream, file){
      return stream
        .pipe(doSomethingWithEachFileIndividually())
        .pipe(concat(file.name));
    }))
    .pipe(gulp.dest('dist'));
});
```


## API

The foreach method takes one argument, a function. This function is called once for each file piped to `foreach` and is passed a stream as its first argument and the file as its second argument. The stream contains only one file.

You can optionally return a stream from the `foreach` function. All the streams returned from `foreach` will be combined and their contents will be emited by `foreach`. 

## License

MIT © [Marius Gundersen](https://github.com/mariusGundersen)

---
_Source: https://npm.io/package/gulp-foreach · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
