Skip to content

Commit

Permalink
use gulp-util isStream
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Dec 12, 2013
1 parent 9fe828c commit dfbc4f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
19 changes: 11 additions & 8 deletions lib/createOutputStream/writeFile.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
var fs = require('fs');
var semver = require('semver');
var isStream = require('../isStream');
var gutil = require('gulp-util');

module.exports = function (writePath, file, cb) {
// if no contents then do nothing
if (typeof file.contents === "undefined") return cb(null, file);

// stream it to disk yo
if (isStream(file.contents)) {
if (gutil.isStream(file.contents)) {
var outStream = fs.createWriteStream(writePath);
file.contents.once('end', function(){
cb(null, file);
Expand All @@ -21,11 +21,14 @@ module.exports = function (writePath, file, cb) {
return;
}

// write it like normal
fs.writeFile(writePath, file.contents, function(err){
if (err) return cb(err);
if (gutil.isBuffer(file.contents)) {
// write it like normal
fs.writeFile(writePath, file.contents, function(err){
if (err) return cb(err);

// re-emit the same data we got in.
cb(null, file);
});
// re-emit the same data we got in.
cb(null, file);
});
return;
}
};
4 changes: 0 additions & 4 deletions lib/isStream.js

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gulp",
"description": "The streaming build system",
"version": "3.1.2",
"version": "3.1.3",
"homepage": "http://github.com/wearefractal/gulp",
"repository": "git://github.com/wearefractal/gulp.git",
"author": "Fractal <[email protected]> (http://wearefractal.com/)",
Expand All @@ -20,7 +20,7 @@
"glob-stream": "~3.0.2",
"mkdirp": "~0.3.5",
"optimist": "~0.6.0",
"gulp-util": "~2.0.0",
"gulp-util": "~2.1.0",
"gaze": "~0.4.3",
"orchestrator": "~0.2.0",
"resolve": "~0.6.1",
Expand Down

0 comments on commit dfbc4f0

Please sign in to comment.