Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 20, 2019
1 parent 1e59fe5 commit d593a3d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
19 changes: 19 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,25 @@ _Type_: `string`<br> _Value_: `'stdout'`, `'stderr'` or `'all'`<br> _Default_:

Which output stream to use with [`result: 'replace'`](#result).

```js
const { src } = require('gulp')
const { stream } = require('gulp-execa')
const through = require('through2')

module.exports.default = () =>
src('**/*')
// Prints the number of lines of each file, including `stderr`
.pipe(
stream(({ path }) => `wc -l ${path}`, { result: 'replace', from: 'all' }),
)
.pipe(
through.obj((file, encoding, func) => {
console.log(file.contents.toString())
func(null, file)
}),
)
```

#### maxConcurrency

_Type_: `integer`<br> _Default_: `100`
Expand Down
4 changes: 3 additions & 1 deletion examples/from.gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const through = require('through2')
module.exports.default = () =>
src('**/*')
// Prints the number of lines of each file, including `stderr`
.pipe(stream(({ path }) => `wc -l ${path}`, { from: 'all' }))
.pipe(
stream(({ path }) => `wc -l ${path}`, { result: 'replace', from: 'all' }),
)
.pipe(
through.obj((file, encoding, func) => {
console.log(file.contents.toString())
Expand Down

0 comments on commit d593a3d

Please sign in to comment.