Giter Site home page Giter Site logo

vinyl-fs's Introduction

vinyl-fs NPM version Build Status Coveralls Status Dependency Status

Information

Packagevinyl-fs
Description Vinyl adapter for the file system
Node Version >= 0.9

Usage

var es = require('event-stream');
var fs = require('vinyl-fs');

var log = function(file, cb) {
  console.log(file.path);
  cb(null, file);
};

fs.src(["./js/**/*.js", "!./js/vendor/*.js"])
  .pipe(es.map(log))
  .pipe(fs.dest("./output"));

API

src(globs[, opt])

  • Takes a glob string or an array of glob strings as the first argument.
  • Possible options for the second argument:
    • buffer - true or false if you want to buffer the file.
      • Default value is true
      • false will make file.contents a paused Stream
    • read - true or false if you want the file to be read or not. Useful for stuff like rming files.
      • Default value is true
      • false will disable writing the file to disk via .dest()
    • Any glob-related options are documented in glob-stream and node-glob
  • Returns a Readable/Writable stream.
  • On write the stream will simply pass items through.
  • This stream emits matching vinyl File objects

watch(globs[, opt, cb])

This is just glob-watcher

  • Takes a glob string or an array of glob strings as the first argument.
  • Possible options for the second argument:
    • Any options are passed to gaze
  • Returns an EventEmitter
    • 'changed' event is emitted on each file change
  • Optionally calls the callback on each change event

dest(folder[, opt])

  • Takes a folder path as the first argument.
  • Possible options for the second argument:
    • cwd - Specify the working directory the folder is relative to. Default is process.cwd()
    • mode - Specify the mode the files should be created with. Default is the mode of the input file (file.stat.mode)
  • Returns a Readable/Writable stream.
  • On write the stream will save the vinyl File to disk at the folder/cwd specified.
  • After writing the file to disk it will be emitted from the stream so you can keep piping these around

vinyl-fs's People

Contributors

yocontra avatar hughsk avatar

Watchers

Gary Chambers avatar James Cloos avatar

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.