Skip to content

Commit dfbc4f0

Browse files
author
Contra
committed
use gulp-util isStream
1 parent 9fe828c commit dfbc4f0

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

lib/createOutputStream/writeFile.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
var fs = require('fs');
22
var semver = require('semver');
3-
var isStream = require('../isStream');
3+
var gutil = require('gulp-util');
44

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

99
// stream it to disk yo
10-
if (isStream(file.contents)) {
10+
if (gutil.isStream(file.contents)) {
1111
var outStream = fs.createWriteStream(writePath);
1212
file.contents.once('end', function(){
1313
cb(null, file);
@@ -21,11 +21,14 @@ module.exports = function (writePath, file, cb) {
2121
return;
2222
}
2323

24-
// write it like normal
25-
fs.writeFile(writePath, file.contents, function(err){
26-
if (err) return cb(err);
24+
if (gutil.isBuffer(file.contents)) {
25+
// write it like normal
26+
fs.writeFile(writePath, file.contents, function(err){
27+
if (err) return cb(err);
2728

28-
// re-emit the same data we got in.
29-
cb(null, file);
30-
});
29+
// re-emit the same data we got in.
30+
cb(null, file);
31+
});
32+
return;
33+
}
3134
};

lib/isStream.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "gulp",
33
"description": "The streaming build system",
4-
"version": "3.1.2",
4+
"version": "3.1.3",
55
"homepage": "http://github.com/wearefractal/gulp",
66
"repository": "git://github.com/wearefractal/gulp.git",
77
"author": "Fractal <contact@wearefractal.com> (http://wearefractal.com/)",
@@ -20,7 +20,7 @@
2020
"glob-stream": "~3.0.2",
2121
"mkdirp": "~0.3.5",
2222
"optimist": "~0.6.0",
23-
"gulp-util": "~2.0.0",
23+
"gulp-util": "~2.1.0",
2424
"gaze": "~0.4.3",
2525
"orchestrator": "~0.2.0",
2626
"resolve": "~0.6.1",

0 commit comments

Comments
 (0)