Giter Site home page Giter Site logo

gulp-fileinfo's Introduction

#gulp-fileinfo

Information

Packagegulp-fileinfo
Description Reads the names of the vynil files that are coming through the pipe or any other properties that you want (See the Vinyl docs for a full list of properties). You can either show the file list in the console or get an array with the list of files.
Node Version >= 0.10

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.