All Projects → m19c → Gulp Run

m19c / Gulp Run

Licence: isc
Pipe to shell commands in gulp

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Gulp Run

Gulp Remember
A plugin for gulp that remembers and recalls files passed through it
Stars: ✭ 149 (+0.68%)
Mutual labels:  gulp, stream
lead
Sink your streams.
Stars: ✭ 14 (-90.54%)
Mutual labels:  gulp, stream
Gulp Awspublish
gulp plugin to publish files to amazon s3
Stars: ✭ 398 (+168.92%)
Mutual labels:  gulp, stream
Uswds Site
USWDS website and documentation
Stars: ✭ 135 (-8.78%)
Mutual labels:  gulp
Gulp Mjml
Add Gulp to your MJML workflow!
Stars: ✭ 137 (-7.43%)
Mutual labels:  gulp
Kefir
A Reactive Programming library for JavaScript
Stars: ✭ 1,769 (+1095.27%)
Mutual labels:  stream
Vue Webgulp
Vue.js + Webpack + Gulp + Vue Loader
Stars: ✭ 146 (-1.35%)
Mutual labels:  gulp
Multi Streaming Server
A NGINX server with RTMP module to send video streaming to multiple services simultaneously (Youtube, Twitch, Dailymotion, Hitbox, Beam, etc...).
Stars: ✭ 132 (-10.81%)
Mutual labels:  stream
Gulp Wxapp Boilerplate
小程序 Gulp 开发脚手架
Stars: ✭ 145 (-2.03%)
Mutual labels:  gulp
Owasp Mth3l3m3nt Framework
OWASP Mth3l3m3nt Framework is a penetration testing aiding tool and exploitation framework. It fosters a principle of attack the web using the web as well as pentest on the go through its responsive interface.
Stars: ✭ 139 (-6.08%)
Mutual labels:  stream
Azure Event Hubs Spark
Enabling Continuous Data Processing with Apache Spark and Azure Event Hubs
Stars: ✭ 140 (-5.41%)
Mutual labels:  stream
Desktoplivestreaming
DesktopLiveStreaming
Stars: ✭ 138 (-6.76%)
Mutual labels:  stream
Player
▶️ video player in Swift, simple way to play and stream media on iOS/tvOS
Stars: ✭ 1,849 (+1149.32%)
Mutual labels:  stream
Glup
Some of the gulp tutorial -《gulp笔记》
Stars: ✭ 136 (-8.11%)
Mutual labels:  gulp
Jaxon
Streaming JSON parser for Elixir
Stars: ✭ 145 (-2.03%)
Mutual labels:  stream
Goka
Goka is a compact yet powerful distributed stream processing library for Apache Kafka written in Go.
Stars: ✭ 1,862 (+1158.11%)
Mutual labels:  stream
Form Data
A module to create readable `"multipart/form-data"` streams. Can be used to submit forms and file uploads to other web applications.
Stars: ✭ 1,947 (+1215.54%)
Mutual labels:  stream
Marble
Marble.js - functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS.
Stars: ✭ 1,947 (+1215.54%)
Mutual labels:  stream
Zipstorer
A Pure C# Class to Store Files in Zip
Stars: ✭ 139 (-6.08%)
Mutual labels:  stream
Genesis Starter Theme
A starter theme for the Genesis Framework with a modern development workflow
Stars: ✭ 141 (-4.73%)
Mutual labels:  gulp

gulp-run

Codacy Badge

Use shell commands in your gulp or vinyl pipeline.

Many command line interfaces are built around the idea of piping. Let's take advantage of that in our Gulp pipeline! To use gulp-run, simply tell it the command to process your files; gulp-run accepts any command you could write into your shell, including I/O redirection like python < baz.py | cat foo.txt - bar.txt. Additionally, node_modules/.bin is included on the path, so you can call programs supplied by your installed packages. Supports Unix and Windows.

This plugin is inspired by gulp-shell and gulp-spawn and attempts to improve upon their great work.

Usage

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

// use gulp-run to start a pipeline
gulp.task('hello-world', function() {
  return run('echo Hello World').exec()    // prints "Hello World\n".
    .pipe(gulp.dest('output'))      // writes "Hello World\n" to output/echo.
  ;
})


// use gulp-run in the middle of a pipeline:
gulp.task('even-lines', function() {
  return gulp
    .src('path/to/input/*')             // get input files.
    .pipe(run('awk "NR % 2 == 0"'))     // use awk to extract the even lines.
    .pipe(gulp.dest('path/to/output'))  // profit.
  ;
});

// use gulp-run without gulp
var cmd = new run.Command('cat');  // create a command object for `cat`.
cmd.exec('hello world');           // call `cat` with 'hello world' on stdin.

API

run(template, [options])

Creates a Vinyl (gulp) stream that transforms its input by piping it to a shell command.

See run.Command for a description of the arguments.

Returns

(stream.Transform in Object Mode): Returns a Transform stream that receives Vinyl files. For each input, a subprocess is started taking the contents of the input on stdin. A new file is pushed downstream containing the process's stdout.

Example

gulp.task('even-lines', function() {
  return gulp
    .src('path/to/input/*')             // get input files.
    .pipe(run('awk "NR % 2 == 0"'))     // use awk to extract the even lines.
    .pipe(gulp.dest('path/to/output'))  // profit.
  ;
})

run(...).exec([stdin], [callback])

Start a gulp pipeline and execute the command immediately, pushing the results downstream.

Arguments

  1. [stdin] (String | Buffer | Vinyl): If given, this will be used as stdin for the command.
  2. [callback] (Function): The callback is called once the command has exited. An Error is passed if the exit status was non-zero. The error will have a status property set to the exit status.

Returns

(Stream.Readable in Object Mode): Returns a Vinyl (gulp) stream which will push downstream the stdout of the command as a Vinyl file. The default path of the Vinyl file is the first word of the template; use gulp-rename for more versatility.

Example

gulp.task('hello-world', function() {
  return run('echo Hello World').exec()  // prints "[echo] Hello World\n".
    .pipe(gulp.dest('output'))           // writes "Hello World\n" to output/echo.
  ;
})

new run.Command(template, [options])

Represents a command to be run in a subshell.

Arguments

  1. template (String): The command to run. It can be a template interpolating the variable file which references the Vinyl file being input. The template need not interpolate anything; a simple shell command will do just fine. The command is passed as an argument to sh -c, so I/O redirection and the like will work as you would expect from a terminal.
  2. options (Object):
    • env (Object): The environmental variables for the child process. Defaults to process.env.
    • cwd (String): The initial working directory for the child process. Defaults to process.cwd().
    • silent (Boolean): If true, do not print the command's output. This is the same as setting verbosity to 1. Defaults to false.
    • verbosity (Number): Sets the verbosity level. Defaults to 2.
      • 0: Do not print anything, ever.
      • 1: Print the command being run and its stderr.
      • 2: Print the command, its stderr, and its stdout.
      • 3: Print the command, its stderr, and its stdout progressivly. Not useful if you have concurrent gulp-run instances, as the outputs may get mixed.
    • usePowerShell (Boolean): Windows only. If true uses the PowerShell instead of cmd.exe for command execution.

run.Command#exec([stdin], [callback])

Spawn a subshell and execute the command.

Arguments

  1. [stdin] (String | Buffer | Vinyl): If given, this will be used as stdin for the command.
  2. [callback] (Function): The callback is called once the command has exited. An Error is passed if the exit status was non-zero. The error will have a status property set to the exit status.

Returns

(Vinyl): Returns a Vinyl file wrapping the stdout of the command.

Example

var cmd = new run.Command('cat');  // create a command object for `cat`.
cmd.exec('hello world');           // call `cat` with 'hello world' on stdin.

The ISC License

Copyright (c) 2014 Chris Barrick [email protected] Copyright (c) 2016 Marc Binder [email protected]

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].