# gulp-file

> Create vinyl files from a string or buffer and insert into the Gulp pipeline.

Latest version **0.4.0** (published 2018-01-02) · BSD license · 0 weekly downloads

## Install

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

## 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.4.0 |
| Published | 2018-01-02 |
| First published | 2014-05-01 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 42 |
| Author | Alex Mingoia |
| Maintainers | ninjabryan, asselin, amingoia |
| Keywords | gulp, plugin, string, buffer, file, vinyl |

## Links

- npm: https://www.npmjs.com/package/gulp-file
- Repository: https://github.com/alexmingoia/gulp-file
- Issues: https://github.com/alexmingoia/gulp-file/issues
- npm.io page: https://npm.io/package/gulp-file

## Dependencies (2)

- [vinyl](https://npm.io/package/vinyl.md) ^2.1.0
- [through2](https://npm.io/package/through2.md) ^0.4.1

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.4.0 (latest) — 2018-01-02
- 0.3.0 — 2016-05-06
- 0.2.0 — 2014-11-07
- 0.1.0 — 2014-05-01

## README

# gulp-file

[![Build Status](https://secure.travis-ci.org/alexmingoia/gulp-file.png)](http://travis-ci.org/alexmingoia/gulp-file) 
[![NPM version](https://badge.fury.io/js/gulp-file.png)](http://badge.fury.io/js/gulp-file)

Create vinyl files from a string or buffer and insert into the Gulp pipeline.

## Installation

```sh
npm install gulp-file
```

## API

### plugin(name, source, options)

Creates a vinyl file with the given `name` from `source` string or buffer and
returns a transform stream for use in your gulp pipeline.

### plugin(sourceArray, options)

Creates vinyl files for each entry in the array.  Each entry is an object with a `name` and `source` property.  A vinyl file is created with the given `name` and `source` and inserted into the returned transform stream.

## Example

[Primus](https://github.com/primus/primus) outputs the client library as a string. Using `gulp-file` we can
create a vinyl file from the string and insert it into the gulp pipeline:

```javascript
var gulp = require('gulp')
  , file = require('gulp-file');

gulp.task('js', function() {
  var str = primus.library();

  return gulp.src('scripts/**.js')
    .pipe(file('primus.js', str))
    .pipe(gulp.dest('dist'));
});
```

Use it at the beginning of your pipeline by setting `src: true`:

```javascript
var gulp = require('gulp')
  , file = require('gulp-file');

gulp.task('js', function() {
  var str = primus.library();

  return file('primus.js', str, { src: true })
    .pipe(gulp.dest('dist'));
});
```

## Options

### src

Calls `stream.end()` to be used at the beginning of your pipeline in place of
`gulp.src()`. Default: `false`.

## BSD Licensed

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