Skip to content

Commit

Permalink
Merge 67a1aba into e16aa35
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Sep 23, 2022
2 parents e16aa35 + 67a1aba commit e7f22e6
Show file tree
Hide file tree
Showing 4 changed files with 1,404 additions and 1,395 deletions.
13 changes: 4 additions & 9 deletions index.js
Expand Up @@ -5,7 +5,7 @@ var util = require('util');
var Buffer = require('buffer').Buffer;

var clone = require('clone');
var cloneable = require('cloneable-readable');
var teex = require('teex');
var replaceExt = require('replace-ext');
var cloneStats = require('clone-stats');
var removeTrailingSep = require('remove-trailing-separator');
Expand Down Expand Up @@ -122,7 +122,9 @@ File.prototype.clone = function (opt) {
// Clone our file contents
var contents;
if (this.isStream()) {
contents = this.contents.clone();
var streams = teex(this._contents);
this._contents = streams[0];
contents = streams[1];
} else if (this.isBuffer()) {
contents = opt.contents ? Buffer.from(this.contents) : this.contents;
}
Expand Down Expand Up @@ -189,13 +191,6 @@ Object.defineProperty(File.prototype, 'contents', {
throw new Error('File.contents can only be a Buffer, a Stream, or null.');
}

// Ask cloneable if the stream is a already a cloneable
// this avoid piping into many streams
// reducing the overhead of cloning
if (isStream(val) && !cloneable.isCloneable(val)) {
val = cloneable(val);
}

this._contents = val;
},
});
Expand Down
13 changes: 7 additions & 6 deletions package.json
Expand Up @@ -24,20 +24,21 @@
"test": "nyc mocha --async-only"
},
"dependencies": {
"clone": "^2.1.1",
"clone": "^2.1.2",
"clone-stats": "^1.0.0",
"cloneable-readable": "^2.1.0",
"remove-trailing-separator": "^1.0.1",
"replace-ext": "^2.0.0"
"remove-trailing-separator": "^1.1.0",
"replace-ext": "^2.0.0",
"teex": "^1.0.1"
},
"devDependencies": {
"eslint": "^7.32.0",
"eslint-config-gulp": "^5.0.1",
"eslint-plugin-node": "^11.1.0",
"expect": "^27.4.6",
"mississippi": "^4.0.0",
"mocha": "^8.4.0",
"nyc": "^15.1.0"
"nyc": "^15.1.0",
"readable-stream": "^3.6.0",
"streamx": "^2.12.5"
},
"nyc": {
"reporter": [
Expand Down

0 comments on commit e7f22e6

Please sign in to comment.