# through-gulp

> A tiny wrapper around Node stream Transform, to simplify gulp plulgins development

Latest version **0.5.0** (published 2016-01-20) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2016-01-20 |
| First published | 2014-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | bornkiller |
| Maintainers | bornkiller |
| Keywords | stream, through, transform, gulp, gulp-plugin |

## Links

- npm: https://www.npmjs.com/package/through-gulp
- Repository: https://github.com/bornkiller/through-gulp
- Homepage: https://github.com/bornkiller/through-gulp#readme
- Issues: https://github.com/bornkiller/through-gulp/issues
- npm.io page: https://npm.io/package/through-gulp

## Dependencies (1)

- [underscore](https://npm.io/package/underscore.md) ^1.8.3

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 0.5.0 (latest) — 2016-01-20
- 0.3.8 — 2014-12-29
- 0.3.7 — 2014-12-26
- 0.3.5 — 2014-12-23
- 0.3.1 — 2014-10-30
- 0.3.0 — 2014-10-09
- 0.2.0 — 2014-09-15
- 0.1.6 — 2014-09-13
- 0.1.5 — 2014-09-13

## README

# through-gulp
![Build Status](https://img.shields.io/travis/bornkiller/through-gulp/master.svg?style=flat)
![Coverage Report](http://img.shields.io/coveralls/bornkiller/through-gulp.svg?style=flat)
![Package Dependency](https://david-dm.org/bornkiller/through-gulp.svg?style=flat)
![Package DevDependency](https://david-dm.org/bornkiller/through-gulp/dev-status.svg?style=flat)

A tiny wrapper around Node streams. To make gulp plugin write easier.
Inspired by through2, (https://github.com/rvagg/through2/), but much simplify
for gulp-plugin development for some reason.

## Install
```js
npm install through-gulp --save
```

## API
Expose single API..

```javascript
var through = require('through-gulp');
var stream = through(transformFunction, flushFunction);
```

Both argument has default value to pipe data next without processing.


## Usage
A simple demonstrate about write gulp-plugin with through-gulp.
If you know nothing about gulp plugin, check this first.
(https://github.com/gulpjs/gulp/blob/master/docs/writing-a-plugin/guidelines.md)


```javascript
// PLUGIN_NAME: sample
var through = require('through-gulp');

// exporting the plugin 
module.exports = sample;

function sample() {
  // creating a stream through which each file will pass
  var stream = through(function(file, encoding,callback) {
  	// do whatever necessary to process the file
    if (file.isNull()) {

    }
    if (file.isBuffer()) {

    }
    if (file.isStream()) {

    }
    // just pipe data next, or just do nothing to process file later in flushFunction
    // never forget callback to indicate that the file has been processed.
      this.push(file);
      callback();
    }, function(callback) {
      // just pipe data next, just callback to indicate that the stream's over
      this.push(something);
      callback();
    });

  // returning the file stream
  return stream;
};
```

then use the plugin with gulp

```javascript
var gulp = require('gulp');
var sample = require('sample');
gulp.task('sample', function() {
  gulp.src(['source file'])
	.pipe(sample())
	.pipe(gulp.dest('file destiny'))
});
```

## Contact
*Email: hjj491229492@hotmail.com*.

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