1.0.6 • Published 6 years ago

gulp-fileinfo v1.0.6

Weekly downloads
58
License
ISC
Repository
github
Last release
6 years ago

#gulp-fileinfo

Information

Usage

var gulp = require('gulp');
var fileinfo = require('gulp-fileinfo');

gulp.task('default', function() {
  return gulp
  	.src('./lib/*.js')
  	.pipe(fileinfo());
});

This will output to the console the list of files coming through the pipe.

If you need to get the list of files in an array, you can pass a callback function as part of the options, that function will receive the list of files in an array as a paramenter

var fileinfo = require('gulp-fileinfo');

gulp.task('default', function() {
  var doSomethingWithTheFilesList = function (filesList){
    //do something with the filesList array here
  }
  
  gulp
    .src('./lib/*.js')
	  .pipe(fileinfo({ callback: doSomethingWithTheFilesList }));
});

The fileList variable will be an array of strings containing the name of the files in the pipe.

Options

By default, the gulp only reads the relative property of the files. If you want something different, you can use:

options.properties

Specifies the name of the property you want to read (instead of reading the relative property) from the files in the pipe, like this:

{"properties": "path"}

If you want to read more than one properties at once, you need to set the properties property as an array of all the properties you want to read.

{"properties": ["relative","path","basename"]}

When the properties value is an array, the filesList array will contain objects (instead of strings), for instance:

[{"relative":"index.js", 
  "path":"path/to/index.js", 
  "basename":"" }]

You can get a full list of the Vinyl files properties here: https://github.com/gulpjs/vinyl

options.callback

Callback function that will be invoked once all the files have been read. It receives as a parameter the filesList array containing all the info read from the files in the pipe.

1.0.6

6 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

9 years ago

1.0.0

9 years ago