Code Monkey home page Code Monkey logo

glob-stream's Introduction

glob-stream

NPM version Downloads Build Status Coveralls Status

Readable streamx interface over anymatch.

Usage

var gs = require('glob-stream');

var readable = gs('./files/**/*.coffee', {
  /* options */
});

var writable =
  /* your WriteableStream */

  readable.pipe(writable);

You can pass any combination of glob strings. One caveat is that you cannot only pass a negative glob, you must give it at least one positive glob so it knows where to start. If given a non-glob path (also referred to as a singular glob), only one file will be emitted. If given a singular glob and no files match, an error is emitted (see also options.allowEmpty).

API

globStream(globs, [options])

Takes a glob string or an array of glob strings as the first argument and an options object as the second. Returns a stream of objects that contain cwd, base and path properties.

Options

options.allowEmpty

Whether or not to error upon an empty singular glob.

Type: Boolean

Default: false (error upon no match)

options.dot

Whether or not to treat dotfiles as regular files. This is passed through to anymatch.

Type: Boolean

Default: false

options.cwd

The current working directory that the glob is resolved against.

Type: String

Default: process.cwd()

options.root

The root path that the glob is resolved against.

Type: String

Default: undefined (use the filesystem root)

options.base

The absolute segment of the glob path that isn't a glob. This value is attached to each glob object and is useful for relative pathing.

Type: String

Default: The absolute path segement before a glob starts (see glob-parent)

options.cwdbase

Whether or not the cwd and base should be the same.

Type: Boolean

Default: false

options.uniqueBy

Filters stream to remove duplicates based on the string property name or the result of function. When using a function, the function receives the streamed data (objects containing cwd, base, path properties) to compare against.

Type: String or Function

Default: 'path'

other

Any glob-related options are documented in picomatch.

License

MIT

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.